Time for action – grouping row items in our TableViewExample application

In our example, we will be grouping our previous example of vegetables into two groups, Organic and Non Organic:

  1. Open our previously created TableViewExample application.
  2. Open and modify the RootViewController.h interface file to include two additional arrays which will be used to hold our Organic and Non Organic items. Modify your RootViewController.h file as shown in the code snippet below:
    #import <UIKit/UIKit.h>
    @interface RootViewController : UITableViewController {
    NSArray *arrOrganic;
    NSArray *arrNonOrganic;
  3. Next, modify the RootViewController.m implementation file. We need to update the viewDidLoad method to include the following code snippet as shown below: ...

Get Xcode 4 iOS Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.