简体   繁体   中英

Change camera orientation when ipad rotates

Iam using the following code for capturing the image from Ipad:

if ( [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] ) {
    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.delegate = imagePickerDelegate;

    imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera | UIImagePickerControllerSourceTypePhotoLibrary;

    UIPopoverController                  *popover;
    [popover setPopoverContentSize:CGSizeMake(320, 480)];
    [popover setContentViewController:imagePicker animated:YES];
}

My Problem is that when i rotate the ipad from portrait to landscape, camera still showing me the portrait image. But when I use full screen for imagepicker it works fine. An idea how I can resolve this.

According to the documentation the UIImagePickerController does not support horizontal mode.

Important The UIImagePickerController class supports portrait mode only. This class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified, with one exception. In iOS 3.1 and later, you can assign a custom view to the cameraOverlayView property and use that view to present additional information or manage the interactions between the camera interface and your code.

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