之前找了一些展示最下面一个cell ,动画效果设为YES 会有滑动效果,设为 NO 会跳一下,非常的不舒服
我发现一开始写的方法
不生效
所以,我找了另一条路,让他不跳,不滑,出来的时候就是展示最后一条,
好了直接上代码
- (void)reloadAfterMessage:(BOOL)show {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (self.talklist.count > 0) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:self.talklist.count - 1 inSection:0];
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:show];
}
});
}
我发现一开始写的方法
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:self.talklist.count - 1 inSection:0];
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:show];
不生效