【发布时间】:2011-05-20 09:55:37
【问题描述】:
我有一个完全支持旋转的应用程序。我正在模态地添加一个UIImagePickerController,它不支持UIInterfaceOrientationLandscape,我无法让控制器保持纵向。
换句话说,我需要禁用 UIImagePickerController 的旋转,以便它保持纵向,而不删除我应用程序其余部分的旋转。这似乎很基本,但我似乎无法找到它。如何防止这种轮换?
更新
按照建议,我尝试使用以下代码进行子类化:
@interface UAImagePickerController : UIImagePickerController {
}
@end
@implementation UAImagePickerController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return UIDeviceOrientationIsPortrait(toInterfaceOrientation);
}
@end
这条线根本没有被断点击中……我认为UIImagePickerView一定有什么奇怪的地方
【问题讨论】:
-
作为记录,我只是注意到我的 iPhone 应用程序中的 imagepickerview 会旋转,即使该应用程序不支持横向。所以似乎没有“合法”的方式来禁用相机视图的旋转?听起来像是雷达,或者至少是一个变更请求。
标签: iphone ios uiviewcontroller rotation uiimagepickercontroller