-1

we can get the UITableViewCell from indexPath easily like this:

UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];

But i only have the row number not the index path, i am using this code to get the cell .

NSArray *visible       = [self.tableView indexPathsForVisibleRows];
NSIndexPath *indexpath = (NSIndexPath*)[visible objectAtIndex:MyRowNumber];
UITableViewCell *tablecell = [self.tableView cellForRowAtIndexPath:indexpath];

Tell me whether its a good approarch and if not which one is.

ammar shahid
  • 411
  • 4
  • 17
  • 1
    see this link may be help you http://stackoverflow.com/questions/31649220/detect-button-click-in-table-view-ios-xcode-for-multiple-row-and-section/31649321#31649321 – Anbu.Karthik Sep 15 '15 at 06:41

1 Answers1

1

You can create a new NSIndexPath with the row number (assuming your table has only one section).

NSIndexPath *indexPath= [NSIndexPath indexPathForRow:yourRowNumber inSection:0];
ninjapro
  • 105
  • 5