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中的图片
网页URL:http://bzwzjz.com/article/jogicp.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 四川成都网站建设 上市集团网站建设 移动网站建设 重庆网站建设 成都网站建设 成都网站建设 专业网站设计 网站设计制作 网站设计 成都网站制作 网站建设 定制网站建设多少钱 企业网站制作 LED网站设计方案 企业网站建设公司 成都网站制作 泸州网站建设 网站建设推广 重庆手机网站建设 成都网站制作 成都企业网站建设 响应式网站设计