我的应用程序包含一些 UITableViews,并且单元格包含几个视图。单元格还需要从服务器加载图像,因此我使用名为SDWenImage的开源工具来异步加载图像。
问题是 UITableViews 在模拟器中滚动流畅,但在 iOS 设备中滚动不流畅。谁能告诉我为什么以及如何解决这个问题。
以下是与上述问题相关的一些代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CellIdentifier";
ItemTableViewCell *cell = (ItemTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = (ItemTableViewCell *)[[[NSBundle mainBundle] loadNibNamed:@"ItemTableViewCell" owner:self options:nil] lastObject];
}
GroupBuy *groupBuy = [tableArray objectAtIndex:indexPath.row];
cell.groupBuy = groupBuy;
[cell refreshData];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[[NSNotificationCenter defaultCenter] addObserver:cell selector:@selector(starAction:) name:@"StarAction" object:nil];
return cell;
}
非常感谢。