I am trying to find a way to prevent or highjack didSelectRowAtIndexPath:. When a user selects a row in the tableview I want first throw an alertview saying “Data will be removed from CD if you do this.” “We will be syncing the data to the server should you continue”.
The user clicks yes continue. I want to prevent the new cell from being selected until the syncing completes. Should the syncing fail I want to pop an alert telling the user it failed and then stop didSelectRowAtIndexPath: from firing, thus preventing the new cell they touched from being selected.
Should the sync be successful I then want didSelectRowAtIndexPath: to be called.
Would the best way be to highjack willSelectRowAtIndexPath:?
Implement the delegate method
-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPathand return
nilfor the relevant indexPathThis will stop the relevant cell being selected.
From the docs for
UITableViewDelegate