IOS延时加载TableView中Cell中的图片

- (UITableViewCell *)tableView:(UITableView *)tableView
         cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    // do something
    [NSThread detachNewThreadSelector:@selector(startImageread:) toTarget:self withObject:indexPath]; // 获取图片
    // do something
}
-(void)startImageread:(NSIndexPath *)indexPath
{                                                                                                      UIImage *newp_w_picpath = ......// 从本地或者网络获取图片
    NSDictionary *cellp_w_picpath = [NSDictionary dictionaryWithObjectsAndKeys:
                               indexPath, @"indexPath",
                               newp_w_picpath,@"p_w_picpath",
                               nil];
    [self performSelectorOnMainThread:@selector(_setOCellImage:) withObject:cellp_w_picpath waitUntilDone:YES];
}
- (void)_setOCellImage:( id )celldata
{
    UIImage *newp_w_picpath = [celldata objectForKey:@"p_w_picpath"];//从参数celldata里面拿出来图片
    NSIndexPath *indexPath = [celldata objectForKey:@"indexPath"];
    [self.DataTable cellForRowAtIndexPath:indexPath].p_w_picpathView.p_w_picpath = newp_w_picpath;
}

网页标题:IOS延时加载TableView中Cell中的图片
本文地址:http://bzwzjz.com/article/jogicp.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 广安网站设计 成都网站建设公司 成都网站制作公司 营销网站建设 盐亭网站设计 宜宾网站设计 成都商城网站制作 成都网站建设 成都网站建设 响应式网站设计 重庆网站建设 成都定制网站建设 网站制作 成都网站设计公司 达州网站设计 企业网站设计 成都网站设计 成都网站建设 专业网站建设 高端网站设计 成都网站建设 重庆手机网站建设