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://csruizhi.cn/article/jogicp.html

其他资讯

Copyright © 2007-2024 成都优众联杰科技有限公司 All Rights Reserved 蜀ICP备2024116266号
友情链接: 四川成都网站建设 成都品牌网站建设 成都网站制作 广安网站设计 成都做网站建设公司 手机网站建设套餐 成都网站建设公司 成都网站建设 网站设计 成都响应式网站建设 成都网站设计 LED网站设计方案 网站制作 宜宾网站设计 成都网站设计 高端品牌网站建设 网站制作 重庆外贸网站建设 成都网站建设公司 成都网站制作 成都网站设计 重庆网站建设