I'm currently setting the UIImageView in my UITableViewCell like this:
// in cellForRowAtIndexPath method
[cell.imageView initWithImage:[UIImage imageNamed:@"myImage.png"]];
However the imageView property on开发者_如何学编程 UITableViewCell is readonly
. The code above works but I don't understand why. Any ideas?
Don't ever call -init...
unless you're creating an object yourself. The cell creates its own image view (that's why it's read-only); you can simply set the image with cell.imageView.image = [UIImage...];
.
精彩评论