我有一个使用自定义 UITableViewCells 的简单 UITableView。 UITableView属性上设置的选项只是样式设置为Grouped。 当我尝试向下滚动不同的项目时,滚动非常跳跃。 我对此进行了相当多的研究,查看 Tricks for improving iPhone UITableView scrolling performance?以及该网站上的一些其他问题。但我还没有真正找到解决方案。
编辑**** 我使用 WSDL Web 服务将数据加载到 UITableViewCells 中。 这些单元格中只有一个 UITextView 和三个按钮。
编辑****
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"NavigatorCell";
NewCell *cell = (NewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"NewCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.postId = [[items objectAtIndex:indexPath.row] objectForKey:@"PostID"];
cell.post.text = [[items objectAtIndex:indexPath.row] objectForKey:@"Post"];
return cell;
}
最佳答案
我看到您的 NewCell
已被子类化。
不要忘记将此方法包含到您的 NewCell.m
- (NSString *) reuseIdentifier
{
return @"Cell Identifier";
}
当然,@"Cell Identifier"
应该与您在 cellForRowAtIndexPath:
中使用的相同。
如果您未能实现此方法,每个单元格将从头开始生成。
关于ios - UITableView静态滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16156700/