我正在try 在完成后滚动到UITableView的底部
我本来有
[self.tableView reloadData]
NSIndexPath* indexPath = [NSIndexPath indexPathForRow: ([self.tableView numberOfRowsInSection:([self.tableView numberOfSections]-1)]-1) inSection: ([self.tableView numberOfSections]-1)];
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
但是我读到重载数据是异步的,所以滚动不会发生,因为self.tableView
、[self.tableView numberOfSections]
和[self.tableView numberOfRowsinSection
都是0.
谢谢
奇怪的是我用的是:
[self.tableView reloadData];
NSLog(@"Number of Sections %d", [self.tableView numberOfSections]);
NSLog(@"Number of Rows %d", [self.tableView numberOfRowsInSection:([self.tableView numberOfSections]-1)]-1);
在控制台中,它返回Sections=1,Row=-1;
当我在cellForRowAtIndexPath
中做完全相同的NSLogs时,我得到了Sections=1和Row=8;(8是正确的)