R – How to make the first table view in a navigation view controller grouped

iphoneuinavigationcontrolleruitableview

I want the first view in my UINavigation Controller grouped, but I can't see where to initWithStyle as UITableViewStyleGrouped.

My MainWindow.xib is set up like:

File's Owner (Outlets: delegate-Test App Delegate)

First Responder

Test App Delegate (Class: TestAppDelegate) (Outlets: navController-Navigation Controller, testListController-Test List Table View, window-Window, delegate-File's Owner)

Window (Outlets: window-Test App Delegate)

Navigation Controller (Class: Navigation Controller) (Outlets: navController-Test App Delegate)

-Navigation BAr

-Test List Table View Controller (Class:TestListTableViewController) (Outlets:testListController-Test App Delegate)

— Naviagtion Item (Class: UINavigationItem)

The code:

// TestAppDelegate.h
@class TestListTableViewController;

@interface TestAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;
    TestListTableViewController *testListController;
    UINavigationController *navController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet TestListTableViewController *testListController;
@property (nonatomic, readonly) IBOutlet UINavigationController *navController;

@end


// TestAppDelegate.m
- (void)applicationDidFinishLaunching:(UIApplication *)application {
    [window addSubview:navController.view];
    [window makeKeyAndVisible];
} // etc

Best Answer

Open up IB, select the Table View within Test List Table View Controller (Class:TestListTableViewController) and in the Inspector window, go to the Attributes (first) tab and change the style from Plain to Grouped

Related Topic