0

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

-(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];
    }
}
4

1 回答 1

0

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

于 2012-05-07T12:31:23.380 回答