如何使用ipad的弹出控制器使UIImagePicker全屏显示

时间:2012-04-26 17:06:39

标签: ios ipad uiimagepickercontroller

我已经看过关于这个主题的其他帖子,但没有有效的解决方案。当然这是可能的!我在这里找到了一个解决方案,它建议从容器视图控制器中呈现它。我的代码在下面的方法中注释掉了。这可以创建全屏视图,但取消/拍照按钮将不起作用,我似乎无法正确解雇它。真的没有简单优雅的解决方案吗????请帮忙!这是我的代码:

-(IBAction)launchCamera:(id)sender
{
    [self.popoverController dismissPopoverAnimated:YES];
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
    {
        //fullScreenViewController = [[UIViewController alloc] init];
        //fullScreenViewController.contentSizeForViewInPopover = CGSizeMake(768, 1024);

        UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];

        //  Tried making the view full screen (or at least larger), but doesn't work...
        //popoverController.contentViewController.contentSizeForViewInPopover = CGSizeMake(384, 512);

        [imagePicker setTitle:@"camera"];
        imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
        imagePicker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeImage];
        imagePicker.delegate = self;
        imagePicker.allowsEditing = NO;

        //[fullScreenViewController.view addSubview:imagePicker.view];
        // change imagePicker to fullScreenViewController here for full screen:
        popoverController = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
        [popoverController setDelegate:self];
        [popoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    }
}

1 个答案:

答案 0 :(得分:0)

我永远无法让UIImagePicker全屏正常工作,所以我最终使用AVFoundation框架来实现自己的。