iOS ---tablewView返回顶部

//***************方法一***************//  

//回滚到表的最顶端  

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

//***************方法二***************//  

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

//***************方法三***************//  

NSIndexPath* indexPat = [NSIndexPath indexPathForRow:0 inSection:0]; 

[self.tableView scrollToRowAtIndexPath:indexPat atScrollPosition:UITableViewScrollPositionBottom animated:YES];


//CGRectMake(0, 0, 1, 1)可以直接返回到UITableView的最顶端
[tableview scrollRectToVisible: CGRectMake( 0, 0, 1, 1) animated: NO];
//CGRectMake(0, 0, 0, 0)设定无效 //
[tableview scrollRectToVisible:CGRectMake(0, 0, 0, 0) animated:NO];



猜你喜欢

转载自blog.csdn.net/iotjin/article/details/80906979
今日推荐