UINavigationBar在iOS8和早期版本中消失了

时间:2016-06-14 07:23:13

标签: ios objective-c storyboard uinavigationbar

第一个ViewControllerNavigationController管理,并且有一个UIWebViewWebView模块具有点击事件以推送ViewController中的NavigationController

但是现在,按代码初始化的ViewController是正常的,init storyboard的{​​{1}}异常,navigation bar消失了。它仅发生在iOS8及更早版本中。

PS:初始化代码是这样的:

代码:

ViewController *vc = [[ViewController alloc]init];
[self.navigationController pushViewController:vc animated:YES];

故事板:

ViewController *vc = [ViewController defaultViewControllerWithStoryboard:@"StoryboardName"];
[self.navigationController pushViewController:vc animated:YES];

谢谢。

1 个答案:

答案 0 :(得分:0)

Give StoryBoard Identifier

MainViewController* presentController = [self.storyboard instantiateViewControllerWithIdentifier:@"StoryBoardidentifier"];
[self.navigationController pushViewController:presentController animated:YES];

如果它不起作用,请尝试通常yourStoryBoardName是Main:

 UIStoryboard* storyBoard = [UIStoryboard storyboardWithName:@"YourStoryBoardName" bundle:nil];
MainViewController* presentController = [storyBoard instantiateViewControllerWithIdentifier:@"StoryBoardIdentifier"];
[self.navigationController pushViewController:presentController animated:YES];