简体   繁体   中英

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM