一個tablview電池使用下面的代碼是設置...爲什麼我的tableview風聲鶴唳,當我滾動
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
MyTableviewcell *cell = [tableView dequeueReusableCellWithIdentifier:@"mytableviewcell" forIndexPath:indexPath];
cell.titleLabel.text = [self.data[indexPath.row] objectForKey:@"node_title"];
cell.taxonomy1Label.text = [self.data[indexPath.row] objectForKey:@"group"];
@try {
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:[self.data[indexPath.row] objectForKey:@"image"]]];
cell.thumbnailImageView.image = [UIImage imageWithData:imageData];
}
@catch (NSException * e) {
NSLog(@"Exception: %@", e);
}
return cell;
}
的try/catch
只是因爲它可能會或可能不會有一個形象,但有人甚至發生前我把它放進去了。看起來好像有一個問題,當它將單元出列時。有任何想法嗎?
[NSData dataWithContentsOfURL:]正在導致滯後。你應該在後臺線程中做到這一點。 –