【发布时间】:2014-03-19 00:32:50
【问题描述】:
我有一个 UITableview,它有一个像这样的图像列表。但是由于某种原因,当我上下滚动时它非常滞后。有什么办法可以阻止这一切?图像不需要重新加载。它需要保持静止。
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:MyIdentifier];
}
ContentModel *contentModel = [self.tableArray objectAtIndex:indexPath.row];
NSURL *url = [NSURL URLWithString:contentModel.txtImages];
NSData *data = [NSData dataWithContentsOfURL:url];
cell.imageView.image = [[UIImage alloc] initWithData:data];
return cell;
}
【问题讨论】:
标签: ios objective-c uitableview uiimage nsdata