从风景到仅仅是肖像 [英] segue from landscape only to portrait only
问题描述
我的应用中有两个页面。一个应该在两个横向模式之间旋转但不允许纵向模式,另一个应该在两个纵向模式之间旋转但不允许横向模式。
I have two "pages" in my app. one which should rotate between the 2 landscape modes but not allow portrait mode and the other which should rotate between the 2 portrait modes but not allow landscape mode.
如何设置它以便在两个视图之间进行切换时正确限制方向?
How can one set this up so that the orientations are limited correctly when segueing between the two views?
推荐答案
如果我是你,我会写我的自己的
segue自定义 UIStoryboardSegue
的执行
方法中目标视图的方向,并且还将设置我想要允许的方向在目标视图控制器的 shouldAutorotateToInterfaceOrientation
中。你可以看看这个问题我前段时间问过,想知道如何实现自定义segue。
I will write my own
segue if I were you and set the orientation of the destination view in the perform
method of your custom UIStoryboardSegue
and will also set the orientation i want to allow in the shouldAutorotateToInterfaceOrientation
of the destination view controller. You can have a look to this question related to custom segue I asked some time ago to get an idea of how to implement custom segue.
这篇关于从风景到仅仅是肖像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!