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:
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.
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.