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
打开IB,在“测试列表”表视图控制器(类: TestListTableViewController
)中选择“表视图”,然后在“检查器”窗口中,转到“属性(第一个)”选项卡,并将样式从“ 普通”更改为“ 分组”
or programmatically you can use this initializer:
initWithFrame:style:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.