How do you tell whether UIImagePickerController cameraOverlayview will rotate or not?

隐身守侯 提交于 2019-12-13 00:16:22

问题


IOS 6 on the Ipad rotates the UIImagePickerController cameraOverlayView on landscape mode, but IOS 6 on the iphone 3GS does not - thank you Apple!

I dont know the behaviour for IOS 5, or other devices, so is there a way of predicting this behaviour so i can apply a rotation transform on the overlay view?

thanks


回答1:


I had this issue as well. Here's what I discovered:

In the Target's "iPad Deployment Info" config, make sure you've enabled "Landscape Left" and "Landscape Right" modes - even if your app doesn't really support these (this can be done through the info.plist file as well, obviously).

Next, in your UIViewController(s), force them to Portrait:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}

- (BOOL)shouldAutorotate
{
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}

Now the UIImagePickerController should rotate correctly when the iPad is rotated to landscape - but your UIViewController will still be Portrait-only.



来源:https://stackoverflow.com/questions/12818748/how-do-you-tell-whether-uiimagepickercontroller-cameraoverlayview-will-rotate-or

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!