- (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;
}免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。