有一个UITableview。当我插入一行时,我称之为
[tableView insertRowsAtIndexPaths:@[lastRow] withRowAnimation:UITableViewRowAnimationLeft];
[tableView scrollToRowAtIndexPath:lastRow atScrollPosition:UITableViewScrollPositionBottom animated:NO];
保持最新的细胞展示。我怎么能听用户滚动tableview。
我尝试添加UIScrollview委托 - scrollViewDidScroll
,但此方法也会监听
[tableView scrollToRowAtIndexPath:atScrollPosition:animated:]
答案 0 :(得分:0)
我认为你应该尝试下面的代码,它对我来说很好
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:selectedIndex inSection:0];
[tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
此处selectedIndex
是您需要展示的。