【问题标题】:Why can’t UIImagePickerController be pushed into navigation stack?为什么 UIImagePickerController 不能推入导航栈?
【发布时间】:2011-01-22 06:34:11
【问题描述】:

使用pushViewController推送UIImagePickerController时:

[self.navigationController pushViewController:pvc animated:YES];

会出现如下错误:

不支持推送导航控制器

正确的解决方案是使用presentModalViewController:

[self presentModalViewController:pvc animated:YES];

有人可以解释为什么这是必要的吗? UIViewController 中隐藏了什么?

谢谢!

【问题讨论】:

    标签: ios uiimagepickercontroller pushviewcontroller presentmodalviewcontroller


    【解决方案1】:

    Apple 不允许堆叠导航栏。由于图像选择器有自己的导航栏,它不能放在导航堆栈中。结果会导致用户混淆,因为会有两个栏、两组导航项、两个标题等。

    【讨论】:

    • 但可以使用navigationBarHidden 属性隐藏其中一个条形
    • 没错,如果我们想使用 UIImagePickerViewController 和 [picker setSourceType:UIImagePickerControllerSourceTypeCamera];
    猜你喜欢
    • 2019-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-01
    • 2023-03-13
    • 1970-01-01
    • 1970-01-01
    • 2018-08-30
    相关资源
    最近更新 更多