K
K
Kirill Sidorov2013-11-29 10:41:14
Objective-C
Kirill Sidorov, 2013-11-29 10:41:14

How to cancel automatic resizing of backgroundView in UITableViewCell?

I can not correctly compose a question in English and searches in Google end in failure, which is why I turn to the community.
In general, I have a simple UITableView and each of its cells has its own background in the form of a picture. Pictures have a resolution of 800xH, where H can vary in the interval [500, 700]. Pictures are loaded from the Internet as needed (I use AFNetworking). Here is the code from the initWithStyle cell:

UIImageView *bgImg = [[UIImageView alloc] init];
[bgImg setImageWithURL:[NSURL URLWithString:self.currNews.img] placeholderImage:nil];
self.backgroundView = bgImg;

And everything seems to be fine, the pictures are compressed to the size of the cell, but due to different heights, some look "flattened". Cell height cannot be changed. Tell me what properties to change in the backgroundView so that it resizes the image in width, but preserves the proportions (the excess would be cut accordingly to fit the frame) .

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question