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

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

    <legend id='RN73b'><style id='RN73b'><dir id='RN73b'><q id='RN73b'></q></dir></style></legend>

        如何在 Swift 中的当前视图上呈现模态

        时间:2023-05-16
          • <legend id='oJPcQ'><style id='oJPcQ'><dir id='oJPcQ'><q id='oJPcQ'></q></dir></style></legend>
            <tfoot id='oJPcQ'></tfoot>

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

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

                  本文介绍了如何在 Swift 中的当前视图上呈现模态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  (Xcode6、iOS8、Swift、iPad)

                  (Xcode6, iOS8, Swift, iPad)

                  我正在尝试创建一个经典的类似 Web 的模式视图,其中对话框的外部是灰色的".为此,我将模态视图的 backgroundColor 的 alpha 值设置为 0.5,如下所示:

                  I am trying to create a classic Web-like modal view, where the outside of the dialog box is "grayed-out." To accomplish this, I've set the alpha value of the backgroundColor of the view for the modal to 0.5, like so:

                  self.view.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.5)
                  

                  唯一的问题是当模态变为全屏时,呈现视图被移除.(参考 导航控制器上的透明模态视图).

                  The only problem is that when the modal becomes full-screen, the presenting view is removed. (Ref Transparent Modal View on Navigation Controller).

                  (对这里的概念有点恼火.为什么要删除底层视图?根据定义,模态显示在其他内容之上.一旦底层视图被删除,它就不再是真正的模态了.它介于模态之间和一个推式过渡.哇哇哇......无论如何......)

                  (A bit irritated at the concept here. Why remove the underlying view? A modal is, by definition, to appear atop other content. Once the underlying view is removed, it's not really a modal anymore. it's somewhere between a modal and a push transition. Wa wa wa... Anyway..)

                  为了防止这种情况发生,我在父控制器的 viewDidLoad 方法和 Storyboard 中将 modalPresentationStyle 设置为 CurrentContext...但没有运气.

                  To prevent this from happening, I've set the modalPresentationStyle to CurrentContext in the viewDidLoad method of the parent controller, and in Storyboard... but no luck.

                      self.modalPresentationStyle = UIModalPresentationStyle.CurrentContext
                      self.navigationController.modalPresentationStyle = UIModalPresentationStyle.CurrentContext
                  

                  当模态变为全屏时,如何防止正在显示的视图被移除?

                  How do I prevent the presenting view from being removed when the modal becomes full screen?

                  tyvm.. 更多信息如下.

                  tyvm.. more info below.

                  也在情节提要中,像这样(演示:当前上下文)

                  Also in Storyboard, like so (Presentation: Current Context)

                  感谢您的帮助...文档如下:

                  Thx for your help... documentation below:

                  推荐答案

                  首先,移除代码中所有显式的模态展示样式设置,然后执行以下操作:

                  First, remove all explicit setting of modal presentation style in code and do the following:

                  1. 在故事板中,将 ModalViewController 的 modalPresentation 样式设置为 Over Current context
                  1. In the storyboard set the ModalViewController's modalPresentation style to Over Current context

                  1. 选中 Root/Presenting ViewController - Provide ContextDefine Context 中的复选框.他们似乎在不受限制地工作.
                  1. Check the checkboxes in the Root/Presenting ViewController - Provide Context and Define Context. They seem to be working even unchecked.

                  这篇关于如何在 Swift 中的当前视图上呈现模态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:ios点击输入框屏幕自动放大怎么处理? 下一篇:如何快速居中弹出视图

                  相关文章

                    <bdo id='9HhyK'></bdo><ul id='9HhyK'></ul>
                • <tfoot id='9HhyK'></tfoot>
                • <legend id='9HhyK'><style id='9HhyK'><dir id='9HhyK'><q id='9HhyK'></q></dir></style></legend>

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

                      <small id='9HhyK'></small><noframes id='9HhyK'>