Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

gameplayerxp

macrumors newbie
Original poster
Dec 1, 2010
23
0
Sydney
I have a customized UITableViewCell which has an UIImageView on left and a UILabel on right. I've already disabled the autosize for UIImageView in Interface Builder. If I set an image for UIImageView in Interface Builder, everything is fine. But if I load an image with the following code:

Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
...

UIImageView *image = (UIImageView *)[cell viewWithTag:0];
image.image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"BookIcon-Default" ofType:@"png"]];
...
}

the image is stretched to right and overlaps the UILabel. I even tried to use different contentMode setting but none of them can help.

Any ideas? Thanks.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.