【发布时间】:2012-05-05 15:28:29
【问题描述】:
我有一个视图控制器,它有一个表视图和一个代表我的模型的 NSArray。在 viewDidLoad 中,我用对象填充数组,然后调用 [tableView reloadData] 来填充表格视图。结果是表格视图被填满了一大块,我不喜欢它。
我希望它向下滑动,就像我在一个接一个地添加一个单元格一样。
这可能吗?
如果我尝试做这样的事情:
[self.tableView beginUpdates];
for (int i=0; i < sortedPersons.count; i++) {
Person *personInfo = [sortedPersons objectAtIndex:i];
[self.myMainModelArr addObject:personInfo];
NSIndexPath *newIndexPath = [NSIndexPath indexPathForRow:i inSection:0];
[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
}
[self.tableView endUpdates];
我收到无效的表格视图更新错误
【问题讨论】:
标签: iphone objective-c uitableview viewdidload