Responding to User Touches

Recipe 9-1 responds to the user in the tableView:didSelectRowAtIndexPath: delegate method. This recipe’s implementation updates the view controller’s title and enables both bar buttons for searching and deselecting. These buttons remain enabled as long as there’s a valid selection. If the user chooses the Deselect option, this code calls deselectRowAtIndexPath:animated: and disables both buttons.

Note

When you want a table cell to ignore user touches, set the cell’s selectionStyle property to UITableViewCellSelectionStyleNone. This disables the gray overlay that displays on the selected cell. The cell is still selected but will not highlight on selection in any way. If selecting the cell produces some kind of side ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.