AIPost *post = [postStore objectAtIndex:[indexPath row]]; cell.dateLabel.text = post.postDate; cell.numberLabel.text = post.postNumber; if (post.image == nil) { [post loadImage]; } cell.imageView.image = post.image; 

After loading the image in the UIImageView, its dimensions become equal to the size of the image itself.

Has anyone come across or knows how to fix it? For I have already tried to save the UIImageView frame before loading the image, and after loading the new frame to equate to the old one.

Help please, thanks in advance! WITH:

  • Do you use autolayouts or on frames? tried to play with the UIViewContentMode parameters? try the methods setContentHuggingPriority:forAxis: and setContentCompressionResistancePriority:forAxis: - BiMaWa

1 answer 1

Suspect autolayout is used? Add constaints for width and height. so that they do not change. You can also play imageView.contentMode with imageView.contentMode

  • I do not use for this UIImageView. - antsy_ivan
  • one
    Is it created programmatically? - iFreeman
  • @iFreeman is not, on xib'e lies. But autolayout is disabled. - antsy_ivan
  • First, make sure that clipsToBounds = YES, and secondly, that contentMode = UIViewContentModeScaleAspectFit is set on your UIImageView (in xib or programmatically has no value). In theory, in the default settings of the UIImageView everything should be set correctly. Show exactly how you upload the image? - iFreeman