TotoroTotoro
TotoroTotoro

Reputation: 17622

UIImagePickerController and a small custom preview

I want to use an UIImagePickerController non-modally, with a small square preview. However, I get a big black bar at the bottom of the preview, which I can't get rid of (see the screenshot). Why is it there, and how can I get rid of it?

Screenshot

Code:

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

}

Upvotes: 0

Views: 440

Answers (1)

matt
matt

Reputation: 535935

This is a misuse of UIImagePickerController. To make your own image-capture interface, simply use AVFoundation.

Upvotes: 2

Related Questions