ModalViewController loading on top of another Modal

六眼飞鱼酱① 提交于 2019-12-31 05:12:10

问题


There may be a better way to do this, and please direct me if there is.

I'm creating an UIImagePickerController with an overlayView in viewDidAppear for 'choose from library', 'take photo', 'flash' 'camera source', etc.

// Set up the camera
imagePicker = [[UIImagePickerController alloc] 
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;

imagePicker.cameraOverlayView = [self cameraOverlayView];
cameraOverlayView.backgroundColor = [UIColor clearColor];
imagePicker.showsCameraControls = NO;
imagePicker.toolbarHidden = YES;

imagePicker.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:imagePicker animated:YES]; 

I then have an IBAction that calls my 'choose from library function', loading another UIImagePickerController to choose a photo from the device.

- (IBAction)library:(id)sender
{
    UIImagePickerController *libraryPicker = [[[UIImagePickerController alloc] init] autorelease];

    libraryPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    libraryPicker.delegate = self;

    [self.imagePicker presentModalViewController:libraryPicker animated:YES];
}

I'm getting a white bar across the top about the size of a status bar when the 'choose from library' modal is presented. I know it has something to do with overlaying a modal on top of a modal, but I don't know how to solve it. (IE, my view layout for 'take photo' navigates fine, although doesn't display the additional 'choose from library' modal).

Any ideas? Any help or direction would be greatly appreciated!


回答1:


Try

[self presentModalViewController:libraryPicker animated:YES];

Instead of

[self.imagePicker presentModalViewController:libraryPicker animated:YES];


来源:https://stackoverflow.com/questions/5073110/modalviewcontroller-loading-on-top-of-another-modal

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