[英]iPhone sdk how to set view orientation with two different views displayed by segmented control
I'm using a segmented control that has two segments. 我正在使用具有两个细分的分段控件。
So, I'm using the following code: 因此,我正在使用以下代码:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (self.view == self.myFirstView)
return false;
else if (self.view == self.mySecondView)
return true;
}
This all works nicely, except for the following condition: If the user selects segment 2, and then rotates the phone, the view goes into landscape mode. 除以下情况外,所有其他方法都很好用:如果用户选择了第2段,然后旋转了手机,则视图进入横向模式。 Then, while still holding the phone in landscape mode, the user presses segment 1. This displays the first view in landscape mode (I only want this view to be displayed in portrait mode).
然后,在仍将手机保持为横向模式的同时,用户按段1。这将在横向模式下显示第一个视图(我只希望此视图以纵向模式显示)。
So, the question is, how do I show the first view, but reset the view orientation to portrait? 因此,问题是,如何显示第一个视图,但将视图方向重置为纵向?
Any ideas? 有任何想法吗?
在view1中,获取方向,如果是横向,则将其切换为portratit。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.