O'Reilly logo

Xcode 4 iOS Development by Steven F. Daniel

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

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;
    }
    @end
    
  3. Next, modify the RootViewController.m implementation file. We need to update the viewDidLoad method to include the following code snippet as shown below: ...

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