如何在ipad中的popOver视图中显示摄像机视图

时间:2012-09-29 08:31:52

标签: ipad uipopovercontroller

大家好我正在使用popoverController显示相机视图,但我没有得到相机视图任何人请帮我这里我的代码。

    picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.showsCameraControls=NO;
picker.delegate = nil;
picker.allowsEditing = NO;

UIViewController *containerController = [[UIViewController alloc] init];
containerController.contentSizeForViewInPopover = CGSizeMake(768, 750);
[containerController.view addSubview:picker.view];

UIPopoverController *popover = [[UIPopoverController alloc]   initWithContentViewController:containerController];

self.popoverController = popover;          
popoverController.delegate = self;          

[popover release];          
CGPoint point = {760,750}; 
CGSize size = {760,750};

[popoverController presentPopoverFromRect:CGRectMake(point.x, point.y, size.width, size.height) 
                                   inView:self.view  permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

这里我得到空的popoverView?视频未显示。

1 个答案:

答案 0 :(得分:1)

我找不到问题。请查看此代码:

picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.showsCameraControls=NO;
picker.delegate = nil;
picker.allowsEditing = NO;
picker.contentSizeForViewInPopover = CGSizeMake(768, 750);

UIPopoverController *popover = [[UIPopoverController alloc]   initWithContentViewController:picker];

self.popoverController = popover;          
popoverController.delegate = self;          

[popover release];          
CGPoint point = {760,750}; 
CGSize size = {760,750};

[self.popoverController presentPopoverFromRect:CGRectMake(point.x, point.y, size.width, size.height) inView:self.view  permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];