Using a Search-Aware Index
Recipe 9-5 highlights some of the other ways to adapt a sectioned table to accommodate search-ready tables. When you support search, the first item added to a table’s section index should be the UITableViewIndexSearch
constant. Intended for use only in table indexes, and only as the first item in the index, this option adds the small magnifying glass icon that indicates that the table supports searches. Use it to provide a quick jump to the beginning of the list. Update tableView:sectionForSectionIndexTitle:atIndex:
to catch user requests. The scrollRectToVisible:animated:
call used in this recipe manually moves the search bar into place when a user taps the magnifying glass. Otherwise, users would have to scroll back ...
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.