我在 http://www.youtube.com/watch?v=LBnPfAtswgw 上关注本教程并能够在 XCode 3 中复制它,但是在 XCode 4 中我遇到了一些问题。
我的应用程序的 Root View Controller 是一个 UITabBarController,我在其中选择了一个选项卡并选择了一个 UINavigationController,然后按照教程的建议拖动了一个 View ,但无法选择我的 UITableViewController 类?
我也没有看到显示选择选项卡栏 Controller 并选择 UINavigation Controller 的部分(大约 9:08)
任何人都可以指导我做错了什么吗?
最佳答案
您可以使用以下代码执行相同的操作:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
TablelViewController *viewController1 = [[TablelViewController alloc] initWithNibName:@"TablelViewController" bundle:nil];
UINavigationController *navigationController1 = [[UINavigationController alloc] initWithRootViewController:viewController1];
TableViewController2 *viewController2 = [[TableViewController2 alloc] initWithNibName:@"TableViewController2" bundle:nil];
UINavigationController *navigationController2 = [[UINavigationController alloc] initWithRootViewController:viewController2];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:navigationController1, navigationController2, nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
这段代码放入:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
关于objective-c - 如何将 UITableViewController 添加到 XCode4 中 UITabViewController 上的 UINavigationController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7852009/