中级农民
- 积分
- 156
- 大米
- 颗
- 鳄梨
- 个
- 水井
- 尺
- 蓝莓
- 颗
- 萝卜
- 根
- 小米
- 粒
- 学分
- 个
- 注册时间
- 2015-5-12
- 最后登录
- 1970-1-1
|
设置图片的时候不要用外面的那个cell来设置,用tableView的`cellForRowAtIndexPath:`(注意不是DataSource里的`tableView:cellForRowAtIndexPath:`方法)来取。如果此时这个cell已经划出去变成不可见了,这个方法会返回nil,也就不会设置到错误的cell上去。- UIImage *img = ...; // 下载完成的image
复制代码
补充内容 (2017-2-16 14:58):
UIImage *img = ...; ///下载完成的image
async(main_queue, ^{[[tableView cellForRowAtIndexPath:indexPath] methodToSetImage:img];}); // 可能需要类型转换一下;不用检查nil,因为给nil发消息什么都不会发生 |
|