Resize image in UITableView

I Created a grouped table view, and I noticed that placing an image in an imageView results in an image that is too large. It overlaps the rounded borders of the cell, which is terrible. I tried to find a way to resize it, but found many answers that did not quite satisfy me. How would you do that? What is the easiest way? The solutions I found where it is strangely difficult. Thank!

+3
source share
3 answers

Other solutions did not satisfy me. The only good solution I found is this . You can resize the UIImage that is passed to the UIImageView.

+3

Interface Builder. UIImegeView " 1", , View/Mode ScaleAspectFit ScaleToFill.

:

imageView.contentMode = UIViewContentModeScaleAspectFit;

imageView.contentMode = UIViewContentModeScaleToFill;
0

Sorry, I made a mistake. First add the image to the tableview cell:

cell.imageView.image = [UIImage imageNamed:@"image.png"]; 

then set the content mode:

cell.imageView.contentMode = UIViewContentModeScaleAspectFit;

or

cell.imageView.contentMode = UIViewContentModeScaleToFill;
0
source

Source: https://habr.com/ru/post/1782070/


All Articles