我正在开发一款iPad应用。它是在popover中捕获图像并在下一个视图中全屏裁剪图像。这里包含以下屏幕
1)LoginViewContoller
(需要所有方向),
2)SplitViewController
(需要所有方向),`
3)ImageCropViewController
(仅需横向景观),
4)SettingsViewController
(需要所有方向)。
在ImageCropViewController
我正在编写以下代码:
- (BOOL)shouldAutorotate
{
return NO;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
我正在准确定位。但它也会影响LoginViewController's
和SettingViewController's
方向。
在LoginViewController
和SettingViewController
中,我正在编写以下代码
- (BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape | UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}
从SplitViewController
导航到ImageCropViewController
时,我发起的ImageCropViewController
为rootViewController
。
在plist中,我支持这样的方向
我用Google搜索了一下。并整合了可用的代码。但我没有找到任何解决方案。请帮我。它真的杀了我的时间。
答案 0 :(得分:0)
这是我在iPhone项目上设置的方式,但它不应该与你的不同:
首先,确保您的项目支持所有您想要的方向:
然后,在SplitViewController,ImageCropViewController和SettingsViewController上覆盖这些方法:
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
最后,在ImageCropViewController上覆盖这些方法:
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
让我知道它是否有帮助!