Search code examples
iphoneobjective-cipaduitableviewcell

UITableView Detect Selected Cell?


I have multiple UITableViews in my app, is there a method of detecting which cell/row the user has selected in that column?

Also is it possible to programatically deselect a cell/row?

Thanks.


Solution

  • Get currently selected index path for a table:

    NSIndexPath *path = [tableView indexPathForSelectedRow];
    

    Deselect currently selected row:

    [tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:YES];