Delegate Methods

Search awareness is not limited to data sources. Determining the context of a user tap is critical for providing the correct response in delegate methods. As with the previous data source methods, this delegate method checks the callback’s table view parameter to determine which table view was active. Based on the selected table and index, it picks a color with which to tint both the search bar and the navigation bar:

// Respond to user selections by updating tint colors - (void)tableView:(UITableView *)aTableView     didSelectRowAtIndexPath:(NSIndexPath *)indexPath {     UIColor *color = nil;     if (aTableView == self.tableView)         color = [crayons colorAtIndexPath:indexPath];     else     { ...

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.