How to detect the row of the cell that has been touched

advertisements

I have a UITableViewController, and of course a UITableView cell in my application. And I have a push segue(to another UIViewController) for the cell. How to detect the row of the cell which has been touched?


You can do this:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    NSLog(@"Selected row is %d",[[self.tableView indexPathForSelectedRow] row]);
}