我正在使用以下代码在iPad中打开弹出视图控制器中的摄像头。一切都很好,除了它始终以横向模式打开。我想在横向模式下打开pop相机。父视图被锁定为横向模式。
请让我知道是否可以将相机框架尺寸更改为纵向模式。
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];
答案 0 :(得分:0)
你可以使用Subclassing UIImagePickerController
来做到这一点 @interface UAImagePickerController : UIImagePickerController {
}
@end
@implementation UAImagePickerController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return UIDeviceOrientationIsPortrait(toInterfaceOrientation);
}
@end