1
我是iOS新手,在Xcode 6更新後,我在taBbar中顯示導航控制器時出現問題。結合TabBar和導航控制器IOS8
在Xcode 5,它是完美的,但現在工作在模擬器上我得到一個錯誤信息「終止應用程序由於未捕獲的異常‘NSInvalidArgumentException’,原因:‘推導航控制器,不支持’」和應用程序崩潰。 這裏是我的代碼:
**appDelegate.m**
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:
(NSDictionary *)launchOptions{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor =[UIColor whiteColor];
[self.window makeKeyAndVisible];
*// tabBar items*
ItemUnViewController *itemUnViewController = [[ItemUnViewController alloc]
initWithNibName:nil
bundle:NULL];
ItemDeuxViewController *itemDeuxViewController = [[ItemDeuxViewController alloc]
initWithNibName:nil
bundle:NULL];
*//tabBar*
UITabBarController *tabBarController = [[UITabBarController alloc] init];
[tabBarController setViewControllers:@[itemUnViewController,itemDeuxViewController]];
*//setting tabBar as rootView*
self.window.rootViewController = tabBarController;
*// navigation Controllers*
UINavigationController *itemUnNavigationController =
[[UINavigationController alloc]
initWithRootViewController:itemUnViewController];
UINavigationController *itemDeuxNavigationController =
[[UINavigationController alloc]
initWithRootViewController:itemDeuxViewController];
*//Combining tabBar and Navigation Controllers*
[tabBarController setViewControllers:@
[itemUnNavigationController,itemDeuxNavigationController]];
return YES;
}
我甚至試過這種方式http://blog.rifkilabs.net/exploring-navigation-controller-and-tab-bar-controller.html,但我得到了同樣的錯誤消息。
感謝您的幫助。