-2

how can i get UITableView row count in didSelectRowatIndexPath.can any one tell me a good way to get it

Vipin
  • 4,718
  • 12
  • 54
  • 81

4 Answers4

1

If you use something like this:

NSLog(@"%i", [indexPath row]);

and you should get the number of the row selected returned in the console. Alternatively you could pass [indexPath row] into a variable and use it inside a conditional statement to perform a different action depending on row selected like this:

int rowSelected = [indexPath row];

if(row == 0)
{
     //do something
}
else if(row == 1)
{
    //do something else
}

Hope this helps

Martin Harvey
  • 223
  • 2
  • 4
  • 9
0

You need to track the number of records passed in numberOfRowsInSection for all sections. If its varying you can keep a variable that stores the number.

Hiren
  • 12,720
  • 7
  • 52
  • 72
DivineDesert
  • 6,924
  • 1
  • 29
  • 61
0
a=indexPath.row;

the a variable has the value you want

Aravindhan
  • 15,608
  • 10
  • 56
  • 71
0
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {  
    return [array count];----->this is the row count You have to use in didselect row method  
}
visakh7
  • 26,380
  • 8
  • 55
  • 69
Rams
  • 1,721
  • 12
  • 22