美文网首页程序员想法读书
iOS UITableView回到顶部

iOS UITableView回到顶部

作者: 海边的遐想 | 来源:发表于2023-02-03 16:54 被阅读0次

//***************方法一***************//
[self.tableView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:NO];

//***************方法二***************//
这个在tableView中使用最好用的
[self.tableView setContentOffset:CGPointMake(0,0) animated:NO];

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

相关文章

网友评论

    本文标题:iOS UITableView回到顶部

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