添加到 UIPopoverController 时 UIImagePickerController 中缺少导航按钮
遇到一个奇怪的问题。添加 UIImagePickerController 时通常显示在导航栏上的取消按钮在我将其添加到 UIPopoverController 时丢失了。
我尝试对 UIImagePickerController 进行子类化并自己向导航栏添加导航按钮,但它没有显示。
如果我选择相机胶卷,后退按钮会自动添加,但取消按钮仍然丢失。
有谁知道什么可能导致这个?
这是我使用的代码。请注意,_popOver 是我的 UIPopoverController 的实例。
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[_popOver setContentViewController:picker animated:YES];
Got a strange problem. The cancel button that normally is shown at the navigation bar when you add a UIImagePickerController is missing when I add it to my UIPopoverController.
I have tried to subclass the UIImagePickerController and add a navigation button to the navigation bar myself, but it did not show up.
If I select my camera roll the back button gets automatically added, but the cancel button is still missing.
Anyone know what could cause this?
Here is the code i use. Note that _popOver is the instance of my UIPopoverController.
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[_popOver setContentViewController:picker animated:YES];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经尝试过这段代码,现在我认为这是默认行为。 UIImagePickerController 通常呈现为模态视图控制器,“取消”按钮的目的是关闭它。当您将 UIImagePickerController 放入 UIPopoverController 时,取消按钮就变得毫无意义。要消除此问题,您只需点击任意位置即可(UIPopoverController 视图除外)。如果您想在 UIPopoverController 将/确实被解雇时访问 UIImagePickerController,请使用 UIPopoverControllerDelegate 方法:
I have tried this code and now I think it's a default behavior. UIImagePickerController usually presented as modal view controller and the aim of Cancel button is to dismiss it. When you put UIImagePickerController into UIPopoverController then Cancel button became meaningless. For dismissing this you can just tap anywhere (except UIPopoverController view). If you want to access UIImagePickerController when UIPopoverController will/did dismissed use UIPopoverControllerDelegate method: