tags:

views:

51

answers:

1

Hello everyone

I hope to know if there is a way to move row to the selected row in UITableView.

for example, row are:

1 2 3 4 5 6 7 8

only 3 rows are visible,

I hope to move row directly to 7

Welcome any comment

Thanks

interdev

+1  A: 

Use scrollToRowAtIndexPath like this:

NSIndexPath* ip = [NSIndexPath indexPathForRow:7 inSection:0];
[tableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionTop animated:YES];
DyingCactus
Should also mention that depending on where/when you need to call this, might have to first call [tableView reloadData]. Another thing is that row indexes are zero-based so to go to your row "7", you would actually have to set indexPathForRow to 6.
DyingCactus