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

<tfoot id='iG2tc'></tfoot>
    <bdo id='iG2tc'></bdo><ul id='iG2tc'></ul>

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

      用 NavigationViewController 快速呈现 ViewController

      时间:2023-05-17
      <tfoot id='DhhYu'></tfoot>

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

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

              <legend id='DhhYu'><style id='DhhYu'><dir id='DhhYu'><q id='DhhYu'></q></dir></style></legend>
              • 本文介绍了用 NavigationViewController 快速呈现 ViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我有系统NavigationViewController -> MyViewController",我想以编程方式将 MyViewController 呈现在第三个视图控制器中.问题是 MyViewController 中没有导航栏.你能帮助我吗?

                I have system "NavigationViewController -> MyViewController", and I programmatically want to present MyViewController inside a third view controller. The problem is that I don't have navigation bar in MyViewController after presenting it. Can you help me?

                var VC1 = self.storyboard.instantiateViewControllerWithIdentifier("MyViewController") as ViewController
                self.presentViewController(VC1, animated:true, completion: nil)
                

                推荐答案

                调用 presentViewController 在现有导航堆栈之外模态呈现视图控制器;它不包含在您的 UINavigationController 或任何其他内容中.如果你想让你的新视图控制器有一个导航栏,你有两个主要选择:

                Calling presentViewController presents the view controller modally, outside the existing navigation stack; it is not contained by your UINavigationController or any other. If you want your new view controller to have a navigation bar, you have two main options:

                选项 1. 将新视图控制器推送到现有导航堆栈上,而不是模态显示:

                Option 1. Push the new view controller onto your existing navigation stack, rather than presenting it modally:

                let VC1 = self.storyboard!.instantiateViewControllerWithIdentifier("MyViewController") as! ViewController
                self.navigationController!.pushViewController(VC1, animated: true)
                

                选项 2. 将新的视图控制器嵌入新的导航控制器并以模态方式呈现新的导航控制器:

                Option 2. Embed your new view controller into a new navigation controller and present the new navigation controller modally:

                let VC1 = self.storyboard!.instantiateViewControllerWithIdentifier("MyViewController") as! ViewController
                let navController = UINavigationController(rootViewController: VC1) // Creating a navigation controller with VC1 at the root of the navigation stack.
                self.present(navController, animated:true, completion: nil)
                

                请注意,此选项不会自动包含返回"按钮.你必须自己建立一个关闭机制.

                Bear in mind that this option won't automatically include a "back" button. You'll have to build in a close mechanism yourself.

                哪个最适合您是人机界面设计问题,但通常很清楚什么最有意义.

                Which one is best for you is a human interface design question, but it's normally clear what makes the most sense.

                这篇关于用 NavigationViewController 快速呈现 ViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:使用 segues 在 NavigationController 中嵌入 UIViewController 下一篇:有没有办法在不使用 UINavigationController 的情况下更改 Storyboard 中 UINavig

                相关文章

                  <bdo id='zVCYB'></bdo><ul id='zVCYB'></ul>

                1. <small id='zVCYB'></small><noframes id='zVCYB'>

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

                    <tfoot id='zVCYB'></tfoot><legend id='zVCYB'><style id='zVCYB'><dir id='zVCYB'><q id='zVCYB'></q></dir></style></legend>