Creating Grouped Preferences Tables

There’s nothing special involved in terms of laying out a new UITableViewController for a preferences table. You allocate it. You initialize it with the grouped table style. That’s pretty much the end of it. It’s the data source and delegate methods that provide the challenge. Here are the methods you need to define:

Image numberOfSectionsInTableView:All preferences tables contain groups of items. Each group is visually contained in an edge-to-edge white background, contrasting with the gray background of the containing table. Return the number of groups you’ll be defining as an integer.

tableView:titleForHeaderInSection: ...

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.