Hi there I have a table cell which contains amongst other things a UIImageView. I want to make this UIImageView have a rounded corner. Here’s the code that I have (relevant snippets):
UIImageView* image;
image = (UIImageView*)[cell viewWithTag:0]; // get the UIImageView from the nib
image.image = [UIImage imageWithData:imageData]; // imagedata contains the image
image.layer.cornerRadius = 10.0;
image.layer.masksToBounds = YES;
image.clipsToBounds = YES;
When I do this, the entire UITableViewCell gets the rounded corners, instead of the UIImageView (see attached image).
Can someone tell me why the rounded corners are applied to the table cell rather than the uiImageView?
(UIImageView*)[cell viewWithTag:0];In
cellsubviews you have onlyUITableViewCellContentViewwithtag == 0.You can manually add the UIImageView to cell.