Enabling Changing of Section Groups
Changing the groups shown in sections requires two main changes: an interface for the user to change the grouping and the code to update the sort and sections.
The interface presents four options: Parked, Make, Model, and Year. Parked corresponds to the default order on dateCreated
. Using a UISegmentedControl
is a good way to present a small number of options. Follow these steps:
1. Open Main_iPhone.storyboard
and find the car table view controller.
2. Drag in a UIView
between the bottom of the navigation bar and the top of the table view (the first prototype cell). Set the background color of the view to Mercury, and then use the Size inspector to set the height to 30
points.
3. Drag a UISegmentedControl
Get Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming 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.