0

我想使用一个UIImagePickerController非模态的,带有一个小方形预览。但是,我在预览的底部得到一个大的黑条,我无法摆脱它(见截图)。为什么它在那里,我怎样才能摆脱它?

截屏

代码:

- (void)viewDidLoad
{
    [super viewDidLoad];

    _imagePickerVC = [[UIImagePickerController alloc] init];
    _imagePickerVC.sourceType = UIImagePickerControllerSourceTypeCamera;
    _imagePickerVC.mediaTypes = @[ (NSString *)kUTTypeImage ];
    _imagePickerVC.wantsFullScreenLayout = NO;
    _imagePickerVC.delegate = (id)self;
    _imagePickerVC.navigationBarHidden = YES;
    _imagePickerVC.allowsEditing = NO;
    _imagePickerVC.showsCameraControls = NO;
    _imagePickerVC.cameraDevice = UIImagePickerControllerCameraDeviceFront;

    CGRect previewFrame = CGRectMake(0, 0, 150, 150);
    [_imagePickerVC.view setFrame:previewFrame];
    _imagePickerVC.view.autoresizesSubviews = YES;
    [self.view addSubview:_imagePickerVC.view];
    [_imagePickerVC viewWillAppear:YES];
    [_imagePickerVC viewDidAppear:YES];

}
4

1 回答 1

2

这是对 UIImagePickerController 的误用。要制作自己的图像捕获界面,只需使用 AVFoundation。

于 2013-04-27T01:42:18.350 回答