Tuesday, 20 August 2013

Custom UITableViewCell Indentation Issue

Custom UITableViewCell Indentation Issue

I've got an interesting problem (please forgive me if this was asked... I
searched Google, actually Bing since I don't use Google, and stack with no
results).
I am creating a custom UITableViewCell with UIIMageView (310 x 310) inside
of the content view of the cell. When everything is said and done and I
actually set the image of the imageView in my controller using cellForRow:
[feedCell.imageView setImage:[UIImage imageNamed:@"image-placeholder"]];
I get this result:

^ Not what I want.
When I get the image view from the tableView using viewWithTag method and
then set the image of the imageView directly, I get the desired result:
UIImageView *imageView = (UIImageView *)[tableView viewWithTag:1];
[imageView setImage:[UIImage imageNamed:@"image-placeholder"]];

So the question is, what is it that I am missing? Why would setting the
imageView via custom cell class be so off while it works otherwise? I
would love to use custom subclass.
P.S. Don't mind Batman stuff. Although I am kind of a fan... liked the 2nd
one the best.

No comments:

Post a Comment