Get Selected index of UITableView Get Selected index of UITableView ios ios

Get Selected index of UITableView


NSIndexPath *selectedIndexPath = [tableView indexPathForSelectedRow];


Get current selected row.May be helpful if you have only one section.

- (NSUInteger)currentSellectedRowIndex{    NSIndexPath *selectedIndexPath = [self.tableView indexPathForSelectedRow];    if (selectedIndexPath) {        return selectedIndexPath.row;    }    else {        return NSNotFound;    }}


Use this code

CGPoint location =[sender locationInView:self.tableView];NSIndexPath *swipedIndexPath = [self.tableView indexPathForRowAtPoint:location];UITableViewCell *swipedCell  = [self.tableView cellForRowAtIndexPath:swipedIndexPath];NSIndexPath *indexPath = [self.tableView indexPathForCell:swipedCell];