0
當用戶到達當前加載內容的末尾時,很難弄清楚如何向我的tableview添加其他部分。我的表是每件內容givien在tableview中的一段這樣的方式設置,我不知道如何去使用這樣的庫添加說50個新的部分到我的表:IOS在加載時插入多個部分更多
https://github.com/samvermette/SVPullToRefresh
- (void)insertRowAtBottom {
__weak SVViewController *weakSelf = self;
int64_t delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[weakSelf.tableView beginUpdates];
[weakSelf.dataSource addObject:[weakSelf.dataSource.lastObject dateByAddingTimeInterval:-90]];
[weakSelf.tableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:weakSelf.dataSource.count-1 inSection:0]] withRowAnimation:UITableViewRowAnimationTop];
[weakSelf.tableView endUpdates];
[weakSelf.tableView.infiniteScrollingView stopAnimating];
});
}
這對我有很大的幫助。感謝您的出色答案! – Tander