IPhone - scroll UITableView for indexing

Once my UITableView is populated with data, I want to go to a specific index. I think this is how you do it:

[[self tableView] scrollToRowAtIndexPath:[NSIndexPath indexPathWithIndex:3] atScrollPosition:UITableViewScrollPositionMiddle animated:NO];

The problem is when should I run this. How do I know when a table has finished loading data?

+3
source share
1 answer

First of all, you should use indexPathForRow:inSection:for pointer paths in table views.

If you want to do something after loading the table, use a view controller viewDidAppear:, and if it's too early, set the selector with performSelector:withObject:afterDelay:.

+4
source

Source: https://habr.com/ru/post/1728766/


All Articles