开发者

Puzzling UIImageView behavior in a UITableViewCell

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...];.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜