为什么不能将 UIImagePickerController 推入导航堆栈?
使用pushViewController
推送UIImagePickerController
时:
[self.navigationController pushViewController:pvc animated:YES];
会出现错误,例如:
不支持推送导航控制器
正确的解决方案是使用presentModalViewController:
[self presentModalViewController:pvc animated:YES];
有人可以解释为什么这是必要的吗? UIViewController
中隐藏了什么?
谢谢!
When using pushViewController
to push UIImagePickerController
:
[self.navigationController pushViewController:pvc animated:YES];
an error will occur such as:
Pushing a navigation controller is not supported
The right solution is to use presentModalViewController
:
[self presentModalViewController:pvc animated:YES];
Can someone explain why this is necessary? What‘s hidden in UIViewController
?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
苹果不允许导航栏堆叠。由于图像选择器有自己的导航栏,因此不能将其放置在导航堆栈中。结果会导致用户困惑,因为会有两个栏、两组导航项、两个标题等。
Apple does not allow stacking of navigation bars. Since the image picker has its own navigation bar, it cannot be placed in a navigation stack. The result would cause user confusion since there would be two bars, two sets of navigation items, two titles, etc.