0

@nathan this is my entire controller. My problem is that when I click a tableview cell, the image size is changed and becomes too long. I can not figure out how to fix the size, I tried everything. To do URL parsing, I used NSXMLParser, while I used SDWebImage to load images into cells.

When I press an element its size changes. Like this:

enter image description here

enter image description here

How to fix?

  • You forgot to paste `tableView:didSelectRowAtIndexPath:` / `tableView:willSelectRowAtIndexPath:` – nathan Jul 26 '17 at 23:02
  • You should probably paste the entire code of your VC if possible. Looks like you might be either modifying the selected cell's dimensions or contentMode – nathan Jul 26 '17 at 23:14
  • @nathan I wrote my entire controller –  Jul 26 '17 at 23:24
  • You code seems fine. You should check this question as it might be a dupe: https://stackoverflow.com/questions/11681273/uitableviewcell-imageview-changing-on-select – nathan Jul 26 '17 at 23:37
  • Post reply says to change the name to imageView, but I do not have a custom cell..I did not declare any image, i used cell.imageView.. how do i do it? –  Jul 26 '17 at 23:39
  • @nathan ok now work. the only problem is: when i open the app, the width of images is differente..how to fix? http://imgur.com/14pOKnW –  Jul 26 '17 at 23:58
  • That seems like a content mode issue. Set contentMode to `aspectFit`/`aspectFill` – nathan Jul 26 '17 at 23:59
  • work! please answer to the question so I'll give you the best answer :) –  Jul 27 '17 at 00:02

1 Answers1

0

That seems like a content mode issue. Set the imageView's contentMode to aspectFit/aspectFill (depends on what you want to achieve)

nathan
  • 9,329
  • 4
  • 37
  • 51