Adding CameraOverlayView on presentModalViewController gives me white space

╄→尐↘猪︶ㄣ 提交于 2019-12-11 05:14:49

问题


I've spent the last three hours here on StackOverlow and the rest of the day on Google but unfortunately I can't figure out what I'm doing wrong.

I'm in a view launched by presentModalViewController: in this view I got some buttons and one is calling an IBAction method who will open UIImagePickerController instance modally.

Until here it's all ok: what I'd like to do is make a custom UIToolBar with 3 button (to open Photo Library, Make a photo, Cancel). I did a new UIView with these objects and I thought I could add in this way:

    picker = [[UIImagePickerController alloc] init];
    [picker setDelegate:self];
    [picker setAllowsEditing:NO];

    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
    CGRect overlayFrame = CGRectMake(0, 436, 320, 44);
    cameraOverlayView.frame = overlayFrame;
    picker.showsCameraControls = NO;
    picker.cameraOverlayView = cameraOverlayView;
    [self presentModalViewController:picker animated:YES];

I see my custom toolbar at the bottom, but on top of this there's a white space until the UIImagePickerController of the camera: for what I see, the sum of the blank space and my UIToolBar is equal to the CameraControls (turned off). When I tap on "photo library" button, I can choose a picture, it works but starting from that point I will see the white space on the parents Views (after the dismissModalViewController:animated).

I can't see a way to fix this.

The most similar topic I found is this: ModalViewController loading on top of another Modal but it doesn't help or work for me.

Any help, at this point, would be very appreciated.

Thank you. Fab

来源:https://stackoverflow.com/questions/7955668/adding-cameraoverlayview-on-presentmodalviewcontroller-gives-me-white-space

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!