Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift:使用代理在模式视图上显示导航栏/顶栏_Swift_Uinavigationcontroller_Modal Dialog_Uikit - Fatal编程技术网

Swift:使用代理在模式视图上显示导航栏/顶栏

Swift:使用代理在模式视图上显示导航栏/顶栏,swift,uinavigationcontroller,modal-dialog,uikit,Swift,Uinavigationcontroller,Modal Dialog,Uikit,我试图强制导航栏在模式视图上显示。根据,我正试图通过将模态视图,nextScreenViewController嵌入一个特殊的导航控制器,nextscreenvigationcontroller来实现这一点 但是,我使用代理模式在初始viewController和nextScreenViewController之间传递数据。在嵌入navigationController之前,我使用以下代码进行初始化: override func prepareForSegue(segue: UIStoryboa

我试图强制导航栏在模式视图上显示。根据,我正试图通过将模态视图,
nextScreenViewController
嵌入一个特殊的导航控制器,
nextscreenvigationcontroller
来实现这一点

但是,我使用代理模式在初始viewController和
nextScreenViewController
之间传递数据。在嵌入navigationController之前,我使用以下代码进行初始化:

override func prepareForSegue(segue: UIStoryboardSegue, sender:   AnyObject?) {
     if segue.identifier == "goToNextScreen" {      
         let nextScreenDelegate = segue.destinationViewController as! nextScreenViewController
          nextScreenDelegate.delegate = self
     }
}
建议,为了解释
nextScreenNavigationController
我应该使用如下代码

 override func prepareForSegue(segue: UIStoryboardSegue, sender:   AnyObject?) {
      if segue.identifier == "goToNextScreen" {
          let navigation: UINavigationController = segue.destinationViewController as! nextScreenNavigationController
          var nextScreenDelegate = nextScreenViewController.init()
          nextScreenDelegate = navigation.viewControllers[0] as! nextScreenViewController
          nextScreenDelegate.delegate = self
  }
}
但是,如果没有崩溃,则会失败-不会传递任何数据


如果您想了解更多我的委托模式,请发表评论。。。我只是想确定这不是一个基本的实现问题。或者,有没有更好的方式在模式视图上显示导航栏?

对不起-没关系!我意识到上面的代码是有效的,我的问题是我没有在故事板中将类
nextScreenNavigationController
分配给navigationController。

对不起-没关系!我意识到上面的代码是有效的,我的问题是我没有在故事板中将类
nextScreenNavigationController
分配给navigationController