0

我正在使用以下代码在 iPad 的弹出视图控制器中打开相机。一切正常,除了它总是以横向模式打开。我想以横向模式打开流行相机。父视图锁定为横向模式。
请让我知道是否可以将相机帧大小更改为纵向模式。

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
imagePicker.delegate = self;
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
self.popOverController = popover;
popover.popoverContentSize = CGSizeMake(350, 500);
popover.delegate = self;
[self.popOverController presentPopoverFromRect:CGRectMake(100, 100, 350,500) inView:self permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
4

1 回答 1

0

你可以用子类化 UIImagePickerController 来做到这一点

 @interface UAImagePickerController : UIImagePickerController {
}
@end

@implementation UAImagePickerController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return UIDeviceOrientationIsPortrait(toInterfaceOrientation);
}
@end
于 2013-06-03T09:28:26.867 回答