【问题标题】:Segue to another storyboard, but navigation controller is still visible转到另一个故事板,但导航控制器仍然可见
【发布时间】:2016-04-23 07:44:45
【问题描述】:

我有两个故事板:

  1. 登录/注册目的(无导航视图控制器)
  2. 主故事板(带有导航视图控制器)

当我点击主情节提要上的注销按钮(导航栏项目)时,我被重定向到登录情节提要,但仍然看到导航栏。 我怎样才能做到这一点,同时离开导航视图控制器,以便导航栏不可见?

【问题讨论】:

  • segue有哪一种类型?
  • 如果可能的话,贴一张你的故事板的截图。

标签: ios iphone xcode swift


【解决方案1】:

在注销事件时,改变窗口的rootViewController,

1) 创建appDelegate的对象 2) 创建 LoginVC 的对象

appDelegateObject.window?.rootViewController = objectOfLoginViewController;

【讨论】:

    【解决方案2】:

    你能做什么,

    当你想显示一个没有导航栏的登录控制器时,使用

            UIStoryboard * board = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
            LoginCntrl * cntrl = [board instantiateViewControllerWithIdentifier:@"LoginCntrl"];
            [self presentViewController:LoginCntrl animated:YES completion:^{
    
        }];
    

    这里instantiateViewControllerWithIdentifier方法中的'LoginCntrl'是storyboard中指定的LoginCntrl的标识符。 因为presentViewController 不是导航控制器的一部分,所以它不会在顶部显示导航栏。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-10
      • 2018-04-09
      • 1970-01-01
      • 2013-01-10
      • 1970-01-01
      • 2013-09-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多