Sections and Indexing Tables
If you look at Phoneapp or Contactsapp, you’ll notice that the alphabetical listing of your contacts has sticky headers at the top of the screen that indicate which part of the list you’re viewing. These are the default UITableView section dividers. You’ll also notice a bar on the right side that acts as a quick index for these sections, which is another built-in element of sections in UITableView. We’re going to learn about both and add them to our app.
Adding sections to a table is pretty easy: implement a few more methods and add some additional logic in the existing dataSource implementations. Ideally, your data should be structured as a hash where the keys are your section titles and the values are rows contained ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access