2

这段 IOS 代码在 IOS 7 之前用于推送新窗口。它不再

 ViewController *secondView = [[ViewController alloc]
                        initWithNibName:@"ViewController"bundle:nil];
   [[self navigationController] pushViewController:secondView animated:YES];

为什么这不再起作用了?

--------EDIT----- 这是didFinishLaunchingwWthOption中的导航控制器

 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
 self.launchViewController = [[LaunchViewController alloc] 
          initWithNibName:@"LaunchViewController" bundle:nil];
self.window.rootViewController = self.LaunchViewController;
[self.window makeKeyAndVisible];
return YES;

- - - -编辑 - - - - -

我第一次调用 [self addNewView] 视图没有出现,控制台中没有错误或崩溃,我添加了一个按钮,如果按下按钮我调用 [self addNewView] 视图出现,如果我用后面导航按钮,我必须点击两次才能返回初始视图。所以视图正在创建但未显示。关于可能是什么问题的任何提示?

4

3 回答 3

0

检查这个:

UINavigationController *navi = [[UINavigationController alloc]initWithRootViewController:self.launchViewController];

self.window.rootViewContro‌​ller = navi;

于 2013-12-25T04:36:15.633 回答
0

有mo navigationController。window.rootViewController应该是一个 navigationController 作为你的逻辑。

于 2013-12-25T04:41:45.990 回答
0

您是否尝试过指定该捆绑包?

ViewController *secondView = [[ViewController alloc]
                    initWithNibName:@"ViewController" bundle: [NSBundle mainBundle]];
于 2013-11-15T16:45:47.833 回答