user4951
user4951

Reputation: 33110

how to make a UITableView return to the top at xcode?

I have a tableView that have at least 30 data. and then at the navigatorController i have a button that will change the view to another view. but if i want to back to my tableView i want to make the tableView return to the top? there are any code to make it work?

Upvotes: 1

Views: 4451

Answers (1)

Deepak Danduprolu
Deepak Danduprolu

Reputation: 44633

UITableView is a UIScrollView subclass so you can use its setContentOffset:animated: method to scroll to the top. You can do something like this in the viewWillAppear: method -

[self.tableView setContentOffset:CGPointZero animated:NO];

Upvotes: 13

Related Questions