O'Reilly logo

RubyMotion by Clay Allsopp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required