• <i id='kYTCC'><tr id='kYTCC'><dt id='kYTCC'><q id='kYTCC'><span id='kYTCC'><b id='kYTCC'><form id='kYTCC'><ins id='kYTCC'></ins><ul id='kYTCC'></ul><sub id='kYTCC'></sub></form><legend id='kYTCC'></legend><bdo id='kYTCC'><pre id='kYTCC'><center id='kYTCC'></center></pre></bdo></b><th id='kYTCC'></th></span></q></dt></tr></i><div id='kYTCC'><tfoot id='kYTCC'></tfoot><dl id='kYTCC'><fieldset id='kYTCC'></fieldset></dl></div>
    <legend id='kYTCC'><style id='kYTCC'><dir id='kYTCC'><q id='kYTCC'></q></dir></style></legend>

        • <bdo id='kYTCC'></bdo><ul id='kYTCC'></ul>
        <tfoot id='kYTCC'></tfoot>

        <small id='kYTCC'></small><noframes id='kYTCC'>

      1. 当我的 ViewController 嵌入到 UINavigationController 中时,如何对值进行 segu

        How do I segue values when my ViewController is embedded in an UINavigationController?(当我的 ViewController 嵌入到 UINavigationController 中时,如何对值进行 segue?)
            <tbody id='RSizC'></tbody>
          1. <tfoot id='RSizC'></tfoot>
            <i id='RSizC'><tr id='RSizC'><dt id='RSizC'><q id='RSizC'><span id='RSizC'><b id='RSizC'><form id='RSizC'><ins id='RSizC'></ins><ul id='RSizC'></ul><sub id='RSizC'></sub></form><legend id='RSizC'></legend><bdo id='RSizC'><pre id='RSizC'><center id='RSizC'></center></pre></bdo></b><th id='RSizC'></th></span></q></dt></tr></i><div id='RSizC'><tfoot id='RSizC'></tfoot><dl id='RSizC'><fieldset id='RSizC'></fieldset></dl></div>

              • <small id='RSizC'></small><noframes id='RSizC'>

                  <bdo id='RSizC'></bdo><ul id='RSizC'></ul>
                  <legend id='RSizC'><style id='RSizC'><dir id='RSizC'><q id='RSizC'></q></dir></style></legend>
                • 本文介绍了当我的 ViewController 嵌入到 UINavigationController 中时,如何对值进行 segue?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有两个视图控制器,它们通过 segue 和 prepareForSegue 方法来回发送值.在我决定将 ViewController 嵌入导航控制器之前,这对我来说一直很完美.

                  I have two view controllers that send values back and forth via segues and the prepareForSegue method. This has been working out perfectly for me until I decided to embed my ViewController inside a Navigation Controller.

                  如果您查看下面的方法,您会发现问题是我的 destinationViewController 不再是 ViewController...它是我新创建的 UINavigationController.

                  If you look at the method below you can see the problem is that my destinationViewController is no longer ViewController... its my newly created UINavigationController.

                  TimeViewController.swift(二级控制器)

                  override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
                  
                          var dest = segue.destinationViewController as! ViewController
                          var min = selectedMinute * 60
                          output = min + selectedSecond
                  
                          dest.returnedLabel = recievedString
                  
                          if cancelled == true {
                              dest.returnedValue = 0
                          } else {
                              dest.returnedValue = output
                          }
                  
                      }
                  

                  一旦我的 ViewController 被嵌入到 UINavigationController 我得到这个错误:

                  Once my ViewController is embedded in the UINavigationController I get this error:

                  Could not cast value of type 'UINavigationController' (0x1088ff698) to 'deleteCoreData.ViewController' (0x106a1f9b0).
                  

                  因此,如果我将我的 destinationViewController 转换为 UINavigationController,我理所当然地无法访问我之前拥有的变量.这些变量是我在控制器之间保存数据的方式.

                  So, if I cast my destinationViewController as a UINavigationController I rightfully lose access to the variables that I had previously. These variables are how I persist the data between the controllers.

                  当我的 ViewController 嵌入到 UINavigationController 中时,我如何分割值?

                  更新:这就是我的故事板的样子...

                  Update: This is what my storyboard looks like...

                  推荐答案

                  将其转换为 ViewController 对我来说效果很好.

                  casting it as ViewController is working fine for me.

                  var dest = segue.destinationViewController as! ViewController
                  

                  你的 segue 连接应该是:

                  And your segue connection should be :

                  这篇关于当我的 ViewController 嵌入到 UINavigationController 中时,如何对值进行 segue?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  UINavigationController inside a UITabBarController inside a UISplitViewController presented modally on iPhone(UISplitViewController 内的 UITabBarController 内的 UINavigationController 以模态方式呈现在 iPhone 上) - IT屋-程序员软件开发技术分
                  ViewController in UINavigationController orientation change(UINavigationController 中的 ViewController 方向更改)
                  Custom back button in UINavigationController(UINavigationController 中的自定义后退按钮)
                  How to add a navigation controller programmatically in code but not as initial view controller(如何在代码中以编程方式添加导航控制器,但不作为初始视图控制器)
                  The correct way to set a light status bar text color in iOS 7 based on different ViewControllers(iOS 7中基于不同ViewControllers设置灯光状态栏文字颜色的正确方法)
                  View being blocked by UITransitionView after being presented(呈现后被 UITransitionView 阻止的视图)
                    • <bdo id='XACce'></bdo><ul id='XACce'></ul>

                          <legend id='XACce'><style id='XACce'><dir id='XACce'><q id='XACce'></q></dir></style></legend>
                        1. <i id='XACce'><tr id='XACce'><dt id='XACce'><q id='XACce'><span id='XACce'><b id='XACce'><form id='XACce'><ins id='XACce'></ins><ul id='XACce'></ul><sub id='XACce'></sub></form><legend id='XACce'></legend><bdo id='XACce'><pre id='XACce'><center id='XACce'></center></pre></bdo></b><th id='XACce'></th></span></q></dt></tr></i><div id='XACce'><tfoot id='XACce'></tfoot><dl id='XACce'><fieldset id='XACce'></fieldset></dl></div>
                            <tbody id='XACce'></tbody>

                          <small id='XACce'></small><noframes id='XACce'>

                          <tfoot id='XACce'></tfoot>