在iPad中显示全相机

时间:2012-11-06 04:25:33

标签: objective-c

我尝试在iPad上显示完整的相机。但它显示非常小的相机。我在下面的代码中使用。

imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    imagePicker.delegate=self;
    imagePicker.cameraOverlayView.frame = CGRectMake(0, 0, 1000, 700);
    [imagePicker.cameraOverlayView sizeToFit];
    UIPopoverController  *popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
    imagePicker.wantsFullScreenLayout = YES;
    [imagePicker release];
                [popover presentPopoverFromRect:CGRectMake(0,0,400,800) 
                                 inView:self.view
               permittedArrowDirections:UIPopoverArrowDirectionAny 
                               animated:YES]; 

1 个答案:

答案 0 :(得分:10)

UIImagePickerControllerUINavigationController。只需将其显示为全屏模态视图控制器而不是弹出窗口。

UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
ipc.delegate = self;
ipc.sourceType = UIImagePickerControllerSourceTypeCamera;
ipc.modalPresentationStyle = UIModalPresentationFullScreen;

[self presentViewController:ipc animated:YES completion:nil];

您只需在iPad上使用弹出框即可从照片库中选择图像。但是摄像机可以全屏显示,没有弹出窗口。