0
  • I use the AsyncImageView to display images in tableview that is
    downloaded from a URL (i used an imageView with a class as
    asyncImageView ).

  • The images have all kinds of different sizes but i need to display the image with a fixed size.

  • I have used constraints on my imageView but still it is behaving wrong.

  • Image size is not perfectly fit and when i click on a cell the image get a bigger size before segue to another controller.

    How do i solve that ..? i tried all my best

smn khan
  • 21
  • 6
  • i think you directly set image to imageview like imageview.image = yourimage instead first set frame to imageView and then set image! – Saurabh Prajapati Jul 06 '15 at 09:42
  • post some code also.so that one can easily understand your problem – Saurabh Prajapati Jul 06 '15 at 09:42
  • i am setting the image url in tableview and asynch image view set image url method call .. which automatically load the image – smn khan Jul 06 '15 at 09:49
  • i have used a custom cell and on this custom cell, i have used and imageView and set its class as AsynchImageView, and i am setting URL which is the property of AsynchImageView. this class then download image for me using the given URL – smn khan Jul 06 '15 at 09:53
  • 1
    if the image is of different sizes then u sud use UIViewContentModeScaleAspectFill contentmode,that will serve ur pupose – Mukesh Jul 06 '15 at 09:55
  • i already done this, no result – smn khan Jul 06 '15 at 10:25

1 Answers1

1

If you want the image to scale to a fixed size you should use aspect fit scaling:

imageView.contentMode = UIViewContentModeScaleAspectFit;
Malthan
  • 7,005
  • 3
  • 20
  • 22
  • it has been set as AspectFit for ImageView in storyboard – smn khan Jul 06 '15 at 09:50
  • If you check the ImageView with the debugger after it has loaded the image is the scale mode still aspect fit? Also what constraints did you put on the ImageView? – Malthan Jul 06 '15 at 09:53
  • i have used a custom cell and on this custom cell i have used and imageView and set its class as AsynchImageView, and i am setting URL which is the property of AsynchImageView. this class the download image for me using the given URL – smn khan Jul 06 '15 at 09:53
  • widht, height, trailing, leading, top space – smn khan Jul 06 '15 at 09:55
  • Then it seems you did everything as it should be done. Have you tried debugging the ImageView and checking which properties change after you click the table row? – Malthan Jul 06 '15 at 10:20
  • this is beyond my imagination now :( – smn khan Jul 06 '15 at 10:27