iPad - 当有多个时,最顶层的模态视图控制器不会关闭
我正在开发双 iPad/iPhone 应用程序。
我遇到的问题仅发生在 iPad 上:
- 根视图控制器在 iPad 上是 UISplitViewController,在 iPhone 上是 UITabBarController
- 模态 UIViewController 可以出现在根控制器上 模态
- UIViewController 可以出现在之前的模态控制器上
- 在 iPad 上,模态控制器正在使用 UIModalPresentationStyle.PageSheet
一切正常,除了从 iPad 中关闭最顶层的模态控制器 - 该方法被调用,但模态视图控制器不会关闭。我通过从前一个模态控制器调用 DismissModalViewControllerAnimated 来关闭。
有什么想法为什么这不能在 iPad 上运行吗?
在所有情况下,我都会从父控制器调用 PresentModalViewController 和 DismissModalViewControllerAnimated 来运行其子模态控制器。
我正在使用 MonoTouch(您可以通过我的方法大小写来判断),但这可能无关紧要。我也可以在 Obj-C 中得到答案。
更新,以下内容可能会使它应该做什么更清楚:
- Root =>模态A =>模态 B
- 关闭模态 B 应该返回 到模态 A
- 关闭模态 A 应该返回 至根
I'm working on a dual-iPad/iPhone application.
I'm having a problem that is occurring on the iPad only:
- Root view controller is a UISplitViewController on iPad, UITabBarController on iPhone
- A modal UIViewController can appear over the root controller
- A modal UIViewController can appear over the previous modal controller
- On iPad, modal controllers are using UIModalPresentationStyle.PageSheet
Everything works, except dismissing the topmost modal controller from the iPad--the method is called, but the modal view controller doesn't dismiss. I dismiss by calling DismissModalViewControllerAnimated from the previous modal controller.
Any ideas why this wouldn't be working on the iPad?
In all cases, I call PresentModalViewController and DismissModalViewControllerAnimated from the parent controller to work its child modal controller.
I'm using MonoTouch (you can tell by my casing of methods), but that is probably irrelevant. I can take answers in Obj-C as well.
UPDATE, following might make what it should do more clear:
- Root => Modal A => Modal B
- Dismissing Modal B should just return
to Modal A - Dismissing Modal A should just return
to Root
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你确定你否认的是正确的观点吗?在模态视图中,假设您想通过单击按钮来关闭视图。在该按钮的方法中,您想要调用 DismissModalViewControllerAnimated 方法。只需说
如果不了解您如何尝试呈现和关闭控制器,则很难真正诊断问题,但这应该可行。一旦显示新视图,您不需要从父控制器执行任何操作...
Are you sure you are dismissing the right view? Inside the modal view, lets say that you want to dismiss the view with a button click. In that button's method, you want to call the DismissModalViewControllerAnimated method. Just say
It's hard to really diagnose the problem without seeing how you are trying to present and dismiss the controller, but that should work. You shouldn't need to do anything from the parent controller once the new view is displayed...
找到了解决方法。必须满足所有这些条件才能修复它:
如果我们在通过应用程序商店获取此内容时遇到问题,我会回复。但就目前而言,这对我们来说是一个很好的解决方案。
Found a workaround. All of these conditions had to be met to fix it:
I will post-back if we have trouble getting this through the app store. But for now, it is a good solution for us.