在我的通用应用程序
中,我在相机界面上创建了一个相机覆盖 View
。请注意,我的应用已锁定为纵向模式
。但是,当我改变 iPad 的界面方向时,叠加层也会随之旋转。但我不想要那样!
如何在界面中阻止它随着旋转而旋转?
这是叠加层在 iPAD 上的纵向外观(按下主页按钮):
这就是 iPAD 横向旋转的方式(主页按钮在左侧):
最佳答案
确保在您的应用设置中禁用除纵向以外的所有方向。
编辑
您还可以创建自定义 UIImagePickerController
类,如下所示:
@interface MyImagePickerController : UIImagePickerController
@end
@implementation MyImagePickerController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return toInterfaceOrientation == UIInterfaceOrientationPortrait;
}
- (BOOL)shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
@end
关于ios - 需要停止相机覆盖的旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21400761/