【问题标题】:ModalViewController loading on top of another ModalModalViewController 加载在另一个 Modal 之上
【发布时间】:2011-02-22 01:18:50
【问题描述】:

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

我正在 viewDidAppear 中创建一个 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];
}

当“从库中选择”模式出现时,我在顶部看到一个与状态栏大小相当的白条。我知道它与在模态之上覆盖模态有关,但我不知道如何解决它。 (即,我的“拍照”视图布局导航良好,但不显示额外的“从库中选择”模式)。

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

【问题讨论】:

    标签: objective-c xcode uiimagepickercontroller modalviewcontroller


    【解决方案1】:

    试试

    [self presentModalViewController:libraryPicker animated:YES];
    

    代替

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

    【讨论】:

    • 谢谢!这无限期地解决了这个问题。我知道这与我的视图层次结构有关 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多