【发布时间】:2011-11-06 11:27:46
【问题描述】:
我的应用程序包含一些 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;
}
非常感谢。
【问题讨论】:
-
你的大部分工作似乎都在
refreshData,你能展示一下那个方法的内容吗?
标签: ios uitableview scroll smooth-scrolling