我的UIPopovercontroller目前正面临一个问题。
下面是事实,我有一个类:ImagePickerViewController (从BaseViewController继承),包含两个属性:
@property (nonatomic, retain) UIImagePickerController *pickerController;
@property (nonatomic, retain) UIPopoverController *popOver;我还在pickerController上应用了一个覆盖,如下所示:
[self presentViewController:pickerController animated:NO completion:nil];
当我想通过UIPopoverController在iPad上显示图像库时:
popOver = [[UIPopoverController alloc] initWithContentViewController:pickerController];我知道这个错误:
*终止应用程序由于未被异常“NSGenericException”,原因:“内容视图控制器参数必须是其关联视图控制器层次结构的根。”
我已经看过this topic了,但这并没有多大帮助。
因此,我认为,呈现pickerController使它看起来不是根源。任何帮助都欢迎:
发布于 2012-11-13 17:00:32
问题是,您正在尝试显示同一pickerController两次,同时。你不能这么做。要么使用presentViewController将其表示为模态视图控制器,要么将其呈现在弹出窗口中。不要同时做这两件事。
要在弹出窗口中显示它,请从必须创建popover的行开始:
popOver = [[UIPopoverController alloc] initWithContentViewController:pickerController];然后调用这两种方法中的一种来表示popover:
[popover presentPopoverFrom.... permittedArrowDirections: UIPopoverArrowDirectionAny animated:YES];https://stackoverflow.com/questions/13363977
复制相似问题