You can use the NSIndexPath -indexAtPosition: method to get the latest index:
NSIndexPath *path = ...;
In your case, you can use the following (as Josh noted in his comment, I assume that you are working with a custom subclass of UITableView because it does not have this particular method ( -indexPathsForSelectedRows: ):
NSArray *indexes = [self.tableView indexPathsForSelectedRows]; for (NSIndexPath *path in indexes) { NSUInteger index = [path indexAtPosition:[path length] - 1]; NSLog(@"%lu", index); }
This will print 0, 1, 2, ...
source share