0
我有一个支持横向和纵向模式的分割视图控制器。当详细视图控制器处于特定视图时,我将禁用纵向并仅允许横向方向。但是,如果用户离开该特定视图,将该设备旋转为纵向,然后返回到该特定视图,该纵向仍然是纵向。我需要它自动旋转回风景。以下是我正在使用的。这些方法都是从我的子类UISplitViewController中调用的,以便方向可以取决于视图控制器。iOS强制splitViewController旋转到横向
#pragma mark - Orientation
- (BOOL)shouldAutorotate
{
// Allow view controller to rotate between landscapes
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
// Return supported interface orientation
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
// Return preferred orientation
return UIInterfaceOrientationLandscapeLeft;
}