当动画设置为 true 时,为什么呈现/关闭会崩溃?
在我的根 UIViewController 中,我使用以下代码调用一个子菜单,第二个 UIViewController:
在根 UIViewController 中
let myInvMenu = InvMenuCtrl()
myInvMenu.modalPresentationStyle = .fullScreen
myInvMenu.modalTransitionStyle = .partialCurl
present(myInvMenu, animated: false)
在新屏幕中,我有一个后退按钮,我想关闭它,然后返回到原始 UIViewController 。
dismiss(animated: false)
在这篇文章中,我将动画设置为 false,因为效果很好。但如果我将其设置为 true,我就会在解雇时崩溃。
从下面的文档中,我假设我不需要自己处理任何事情,但显然如果有人可以告诉我我的误解在哪里:
呈现视图控制器负责关闭视图 它提出了控制器。如果您在呈现的视图上调用此方法 控制器本身,UIKit 要求呈现视图控制器处理 解雇。
Within my root UIViewController I call up a submenu, second UIViewController, with the following code:
within root UIViewController
let myInvMenu = InvMenuCtrl()
myInvMenu.modalPresentationStyle = .fullScreen
myInvMenu.modalTransitionStyle = .partialCurl
present(myInvMenu, animated: false)
Within the new screen, I have a back button, I want dismiss it, and return to the original UIViewController.
dismiss(animated: false)
In this post, I have the animation set to false, because that works fine. But if I set it to true, I crash on the dismissal.
From the docs, below I assumed that I didn't have to handle anything myself, but obviously if someone could tell me where my misunderstanding is:
The presenting view controller is responsible for dismissing the view
controller it presented. If you call this method on the presented view
controller itself, UIKit asks the presenting view controller to handle
the dismissal.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果用于发送和解除
UIViewController
,则.modalTransitionStyle = .partialCurl
似乎会出现故障一段时间,请尝试 此答案使用遏制进行相同的演示UIView
或使用模仿.partialCurl
过渡的自定义动画自行创建自定义UIPresentationController
。希望您能找到适合您的解决方案。Looks like the
.modalTransitionStyle = .partialCurl
is malfunctioning for some time if used for poresenting and dismissing ofUIViewController
Try This Answer to make the same presentation using containment ofUIView
s or create yourself customUIPresentationController
with custom animation that mimics.partialCurl
transition. Hopefully you will find right solution that fits you.