简体   繁体   English

如何将导航视图控制器中的第一个表格视图分组?

[英]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.

相关问题 如何使用分组的UITableView在iPhone上创建可编辑的详细信息视图? - How do I make an editable detail view on the iPhone with a grouped UITableView? 如何为分组表视图设置背景图像? - How do I set a background image for a grouped table view? 如何将表视图“连接”到视图 controller - How do I “connect” a table view to a view controller iPhone-如何在视图中添加导航控制器? - iPhone - how do I add a navigation controller to a view? 使用导航控制器时如何初始化视图 - How Do I Initialize a View When Using Navigation Controller 如何重新显示表格视图 - How do I make a table view redisplay 如何将信息从一个视图控制器中的表视图单元传递到另一视图控制器? - How do I pass information from a table view cell in one view controller to another view controller? 如何首先解雇模态视图控制器? - How do i get dismiss modal view controller to happen first? 当按下视图控制器时,如何使rightBarButtonItem保持不变? - How do I make the rightBarButtonItem STAY when a view controller is pushed on? 如何为所有导航控制器和视图控制器设置自定义导航栏(标题+ titleView)? - How do I set custom navigation bar(title + titleView) for all navigation controllers and view controller?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM