我正在开发一个 ios 应用程序,该应用程序必须在横向和纵向上工作,除了一个视图,它应该始终处于横向状态。所以我有:
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) || (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
如果我在横向模式下午餐我的应用程序,并进入此视图并旋转设备(iPad),则调用此方法并返回 false,因此界面不会旋转,好东西。
但是,如果我处于纵向并进入此视图,则会调用此方法并返回 false,但是方向不会改变。在这种情况下,如果我将设备旋转到横向,该方法返回 true 并且界面正确旋转,如果我尝试再次旋转到纵向,此方法返回 false 并且界面保持横向。
第一次看到这个视图时,如果设备是纵向的,界面会变成横向,我该如何实现呢?
另外,我尝试过
- (NSUInteger)supportedInterfaceOrientations
但它永远不会被调用。
提前致谢!