UIViewController,以模态显示,在设备旋转时自行解除 [英] UIViewController, displayed modally, dismisses itself upon device rotation

查看:22
本文介绍了UIViewController,以模态显示,在设备旋转时自行解除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UIViewController 用作登录视图,它以模态方式显示在 UISplitViewController 上方.一旦用户成功登录,模态视图就会消失.拆分视图控制器中的主视图控制器有一个左栏按钮项可以注销.点击注销按钮后,登录视图控制器将再次以模态显示.如果用户此时旋转设备,则模式登录视图将被关闭.

I've got a UIViewController that I'm using as a login view that's displayed modally above a UISplitViewController. Once the user has successfully logged in, the modal view is dismissed. The master view controller in the split view controller has a left bar button item to logging out. Once the logout button is tapped the login view controller is displayed modally again. If the user rotates the devices at this time, the modal login view is being dismissed.

我不知道如何抓住这个.在登录视图控制器上的 viewWillDissappear 上设置断点时,只会调用系统 API - 我什么也没写.

I have no idea how to catch this. When setting a breakpoint on viewWillDissappear on the login view controller only system API's are being called - nothing I wrote.

可以在此处找到重现该问题的示例应用:http://d.pr/f/c6oG

A sample app that reproduces the problem can be found here: http://d.pr/f/c6oG

重现步骤:以纵向模式启动附加的应用程序.点击登录按钮.点击主按钮.点按退出.向左或向右旋转设备.模态视图关闭.

Steps to Reproduce: Launch the attached app in portrait mode. Tap the login button. Tap the master button. Tap logout. Rotate the device left or right. The modal view dismisses.

预期结果:以纵向模式启动附加的应用程序.点击登录按钮.点击主按钮.点按退出.向左或向右旋转设备.模态视图不会关闭.

Expected Results: Launch the attached app in portrait mode. Tap the login button. Tap the master button. Tap logout. Rotate the device left or right. The modal view doesn't dismiss.

实际结果:完成上述重现步骤后,模态视图会在设备旋转时消失.

Actual Results: The modal view dismisses upon device rotation after completing the steps to reproduce above.

我还填补了一个雷达错误 #12585564.

I've also filled a radar bug #12585564.

有什么想法吗?提前致谢!

Any ideas? Thanks in advance!

推荐答案

虽然这不是我想要的,但我最终覆盖了 DetailViewController 中的 splitViewController:shouldHideViewController:inOrientation:.之后,问题就不会发生了.

Although it's not exactly what I was looking for, I ended up overriding splitViewController:shouldHideViewController:inOrientation: in the DetailViewController. After that, the issue does not happen.

我喜欢主视图控制器在设备旋转时停留在屏幕上的外观 - 类似于设置"应用.

I do like the look of the master view controller staying on screen when the device rotates - similar to the Settings app.

这篇关于UIViewController,以模态显示,在设备旋转时自行解除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆