ModalViewController加载在另一个Modal之上

时间:2011-02-22 01:18:50

标签: objective-c xcode uiimagepickercontroller modalviewcontroller

可能有更好的方法来做到这一点,如果有的话,请指导我。

我正在viewDidAppear中创建一个带有overlayView的 UIImagePickerController ,用于“从库中选择”,“拍照”,“闪光”,“相机来源”等。

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

然后我有一个IBAction调用我的'库选择功能',加载另一个UIImagePickerController从设备中选择一张照片。

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

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

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

当显示“从库中选择”模式时,我在顶部有一个关于状态栏大小的白条。我知道它与在模态顶部叠加模态有关,但我不知道如何解决它。 (IE,我的'拍照'视图布局导航很好,虽然没有显示额外的'从库中选择'模态)。

有什么想法吗?任何帮助或方向将不胜感激!

1 个答案:

答案 0 :(得分:1)

尝试

[self presentModalViewController:libraryPicker animated:YES];

而不是

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