【发布时间】:2012-05-11 08:36:39
【问题描述】:
如何在UITableView 中无限滚动?我知道如何使用UIScrollView 来做到这一点,Apple 在其中一个 WWDC 的视频中进行了演示。我尝试在tableView:cellForRowAtIndexPath: 中执行以下操作:
if (indexPath.row == [self.newsFeedData_ count] - 1)
{
[self.newsFeedData_ addObjectsFromArray:self.newsFeedData_];
[self.tableView reloadData];
}
但这失败了。还有什么想法吗?
【问题讨论】:
-
如果您在调用
[self.newsFeedData_ addObjectsFromArray:self.newsFeedData_];之前和之后NSLogself.newsFeedData_输出是否相同? (也许从只输出[self.newsFeedData_ count]开始,看看数组中的记录数是否增加了? -
这里是 Swift 中无限 UITableView 的演示:github.com/i-schuetz/tableview_infinite
-
我已经添加了an answer here,它使用 UITableViewDelegate tableView(_:willDisplay:forRowAt:) 实例方法非常简单。
标签: iphone objective-c ios ipad