开发者

Is it possible to pop the camera on the iPad 2 inside of a UIPopoverController using presentModalViewController?

开发者 https://www.devze.com 2023-03-11 08:08 出处:网络
Is it possible to pop the camera (using UIImagePickerControllerSourceTypeCamera) on the iPad 2 inside of a UIPopoverController using presentModalViewController?

Is it possible to pop the camera (using UIImagePickerControllerSourceTypeCamera) on the iPad 2 inside of a UIPopoverController using presentModalViewController?

Whenever I do it the camera just 开发者_高级运维goes full screen. I need it inside of the UIPopoverController.


This won't work by calling presentModalViewController:animated:. To make the camera show up in a UIPopoverController's UI, then you want something similar to the following:

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.allowsEditing = YES;
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;   

UIPopoverController *popover = [[UIPopoverController alloc] 
                                 initWithContentViewController:imagePicker];
[popover presentPopoverFromBarButtonItem:launchCameraButton
                permittedArrowDirections:UIPopoverArrowDirectionAny
                                animated:YES];

There is another way to launch the popover from an arbitrary spot in your UI also. The docs should explain that.

0

精彩评论

暂无评论...
验证码 换一张
取 消