![](/img/trans.png)
[英]How do I make an editable detail view on the iPhone with a grouped UITableView?
[英]How do I make the first table view in a navigation view controller grouped?
我希望將UINavigation Controller中的第一個視圖分組,但是我看不到initWithStyle作為UITableViewStyleGrouped的位置。
我的MainWindow.xib設置如下:
文件的所有者(出口:委托-測試應用程序委托)
急救人員
測試應用程序代理(類:TestAppDelegate)(出口:navController-Navigation Controller,testListController-測試列表視圖,窗口-窗口,委托-文件的所有者)
窗口(出口:window-Test App Delegate)
導航控制器(類:導航控制器)(出口:navController-Test App Delegate)
-導航欄
-測試列表表視圖控制器(類:TestListTableViewController)(出口:testListController-測試應用程序委托)
-導航項目(類:UINavigationItem)
編碼:
// 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
)中選擇“表視圖”,然后在“檢查器”窗口中,轉到“屬性(第一個)”選項卡,並將樣式從“ 普通”更改為“ 分組”
或以編程方式可以使用以下初始化程序:
initWithFrame:style:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.