Ios – How to set fixed size for UITableViewCell’s ImageView

cocoa-touchiosiphoneuiimageviewuitableview

For my application's contact view, I have added individual users image based on his email id in an table view. Because of difference in image size of each user, image view is not unique for all user, some image view's width is more, So I set the frame size of UItableViewCell with fixed width, still the width size varies.

 [cell.imageView setFrame:CGRectMake(0, 0, 55, 55)];

What should I do? Do I need to add new image view as subview for cell? Any idea?

Best Answer

UITableView's imageView property is read-only. You can resize your image before setting to your cell's imageView. To resize the image, you can get help from this StackOverflow answer.

Also, if you are loading your images from a web environment, you can use my fork of AFNetworking, I added image resizing options into the UIImageView extensions. https://github.com/polatolu/AFNetworking