[英]How do I make the first table view in a navigation view controller grouped?
I want the first view in my UINavigation Controller grouped, but I can't see where to initWithStyle as UITableViewStyleGrouped. 我希望将UINavigation Controller中的第一个视图分组,但是我看不到initWithStyle作为UITableViewStyleGrouped的位置。
My MainWindow.xib is set up like: 我的MainWindow.xib设置如下:
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) 测试应用程序代理(类:TestAppDelegate)(出口:navController-Navigation Controller,testListController-测试列表视图,窗口-窗口,委托-文件的所有者)
Window (Outlets: window-Test App Delegate) 窗口(出口:window-Test App Delegate)
Navigation Controller (Class: Navigation Controller) (Outlets: navController-Test App Delegate) 导航控制器(类:导航控制器)(出口:navController-Test App Delegate)
-Navigation BAr -导航栏
-Test List Table View Controller (Class:TestListTableViewController) (Outlets:testListController-Test App Delegate) -测试列表表视图控制器(类:TestListTableViewController)(出口:testListController-测试应用程序委托)
-- Naviagtion Item (Class: UINavigationItem) -导航项目(类: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: initWithFrame:style:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.