美文网首页
UITableView回滚到顶部的几种方法

UITableView回滚到顶部的几种方法

作者: 你说明哥我说哎 | 来源:发表于2017-09-12 11:27 被阅读19次

UITableView回滚到顶部回滚到表的最顶端

  • 方法一

NSIndexPath* indexPat = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView scrollToRowAtIndexPath:indexPat atScrollPosition:UITableViewScrollPositionBottom animated:YES];

  • 方法二

[self.tableView setContentOffset:CGPointMake(0,0) animated:YES];

  • 方法三

[self.tableView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES];

相关文章

网友评论

      本文标题:UITableView回滚到顶部的几种方法

      本文链接:https://www.haomeiwen.com/subject/inccsxtx.html