【发布时间】:2016-04-23 07:44:45
【问题描述】:
我有两个故事板:
- 登录/注册目的(无导航视图控制器)
- 主故事板(带有导航视图控制器)
当我点击主情节提要上的注销按钮(导航栏项目)时,我被重定向到登录情节提要,但仍然看到导航栏。 我怎样才能做到这一点,同时离开导航视图控制器,以便导航栏不可见?
【问题讨论】:
-
segue有哪一种类型?
-
如果可能的话,贴一张你的故事板的截图。
我有两个故事板:
当我点击主情节提要上的注销按钮(导航栏项目)时,我被重定向到登录情节提要,但仍然看到导航栏。 我怎样才能做到这一点,同时离开导航视图控制器,以便导航栏不可见?
【问题讨论】:
在注销事件时,改变窗口的rootViewController,
1) 创建appDelegate的对象 2) 创建 LoginVC 的对象
appDelegateObject.window?.rootViewController = objectOfLoginViewController;
【讨论】:
你能做什么,
当你想显示一个没有导航栏的登录控制器时,使用
UIStoryboard * board = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
LoginCntrl * cntrl = [board instantiateViewControllerWithIdentifier:@"LoginCntrl"];
[self presentViewController:LoginCntrl animated:YES completion:^{
}];
这里instantiateViewControllerWithIdentifier方法中的'LoginCntrl'是storyboard中指定的LoginCntrl的标识符。
因为presentViewController 不是导航控制器的一部分,所以它不会在顶部显示导航栏。
【讨论】: