如何确保当用户激活相机时,如果设备(iPhone / iPod / iPad)被设为肖像,我想通知用户将设备旋转到横向并拍摄风景照片/录制视频?
但是,app(我所有的UIViewControllers,UITableViewControllers等)都只处于纵向模式,没有风景。
答案 0 :(得分:0)
检查界面方向:
if (UIInterfaceOrientationIsPortrait([UIDevice currentDevice].orientation))
{
// call methods to take picture
....
}
else
{
// alert the user this device is not landscape mode
...
}
答案 1 :(得分:0)
在iOS 6中,自动旋转稍有变化,但是,相同的方法仍然有效。
示例代码:
@implementation UIImagePickerController (noRotation)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation /* iOS 5 */
{
return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}
- (NSUInteger)supportedInterfaceOrientations /* iOS 6 */
{
return UIInterfaceOrientationMaskLandscape;
}
@end