我正在开发一款仅支持横屏的iPad应用程序,我希望允许某些呈现的视图控制器支持所有方向,而不改变呈现视图控制器的方向。在Xcode设置中,我支持除了倒置方向之外的所有方向。
我使用以下代码来呈现视图控制器:
ViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"VC"];
vc.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:vc animated:YES completion:nil];
我使用的代码允许呈现视图控制器的方向:
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
return YES;
}
You Tube应用程序在播放视频时提供了相同类型的功能,您知道它是如何工作的吗?
非常感谢您的帮助。