how can i get UITableView row count in didSelectRowatIndexPath.can any one tell me a good way to get it
Asked
Active
Viewed 2,830 times
-2
-
i cant able to get your question clearly.. can you edit your question more cleary.... – Aravindhan May 26 '11 at 08:41
-
1do you want total numbers of rows in did select row method or you want the rowno of the selected row? – Gypsa May 26 '11 at 08:43
4 Answers
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
-
Sorry, first line of code should read NSLog(@"%i, [indexPath row]); – Martin Harvey May 26 '11 at 08:43
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