开发者

iPhone - scroll UITableView to index

Once my UITableView h开发者_StackOverflowas been populated with data, I want to scroll 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 I'm supposed to run this. How do you know when a table has finished loading data?


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

If you want to do something after the table view is loaded, use your view controller's viewDidAppear:, and if this is too early, enqueue a selector using performSelector:withObject:afterDelay:.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜