I am trying to give users an error when they don't select a row in the table view. Now, the only problem is the searchDisplayController.
This is the IF loop I've came up with for the searchDisplayController. It just doesn't seem to work because every time I select a row, even without using search, the app displays the error.
For example, with the setup available here: http://pastebin.com/q90F3EDa:
- search for data
- select a row
- tap on the row
- Hit button
- Gets error
same happens with this setup even when not searching:
- select a row
- hit send
get error
if (self.searchDisplayController.searchResultsTableView.indexPathForSelectedRow == nil) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Select a User" message: @"Please select a user to send a message to." delegate: nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show];
}
I would really appreciate if someone could help me fix this annoying bug.
Thanks, Arman