HardCode
HardCode

Reputation: 99

iPhone UITableView Controller shows last item on the startup

UITableView shows last item on the startup. How do I view the first item on the startup?

Upvotes: 0

Views: 238

Answers (1)

Nekto
Nekto

Reputation: 17877

You can call following method to position your table view to any cell that you want:

- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated;

For example,

[tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];

Upvotes: 1

Related Questions