• <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

        时间:2023-06-12
            <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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:嵌套推送动画可能导致导航栏损坏多次警告 下一篇:在 clickedButtonAtIndex 中显示警报?

                  相关文章

                  • <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>
                  2. <small id='XACce'></small><noframes id='XACce'>

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