navigationItem.prompt & UIImagePickerController
是否可以调用 UIImagePickerController 上的 navigationItem?具体来说,图像选择器?下面我链接了我想要实现的目标的图像(从执行相同操作的另一个应用程序获取的屏幕截图)。一旦用户从选择器中选择了图像,navigationItem.prompt 就会被设置,尽管我认为这可能是 HIG 违规,但右栏按钮会从标准取消按钮更改。我可以在“正常”视图上设置提示,没有问题:
self.navigationItem.prompt = myString;
但是,当我尝试在选择器的上下文中使用它时,这似乎不起作用:
myPicker.navigationItem.prompt = myString;
我尝试在创建选择器时以及在 didFinishPickingMediaWithInfo: 中使用它,这确实是我需要设置它的地方,因为我让用户选择多个图像,而不是在选择一个图像后立即关闭选择器。似乎没什么作用。
这是所需行为的图像:
Is it possible to make calls to navigationItem on a UIImagePickerController? Specifically, the image picker? Below I've linked an image of what I'm trying to achieve ( screen shot taken from another app doing the same thing). Once the user selects an image from the picker the navigationItem.prompt is set and, though I think it might be a HIG violation, the right bar button is changed from the standard cancel button. I can set the prompt on a "normal" view no problem with:
self.navigationItem.prompt = myString;
But this does not seem to work when I try to use it in the context of a picker with:
myPicker.navigationItem.prompt = myString;
I've tried using it when the picker is created and also in didFinishPickingMediaWithInfo: which is really where I need to set it as I'm letting the user select multiple images instead of dismissing the picker as soon as one image is selected. Nothing seems to work.
Here's a image of the desired behavior:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有人在苹果开发论坛上为我回答了这个问题:
我没有正确访问导航栏。
Someone answered this for me on the Apple dev forums:
I wasn't correctly accessing the navbar.
有人在 Apple 开发论坛上为我回答了这个问题:
UINavigationBar *bar = picker.navigationBar;
UINavigationItem *navItem = bar.topItem;
navItem.prompt = @"一些新的提示";
我没有正确访问导航栏。
在调用“presentModalViewController”后使用代码......如下所示...
[controllerpresentModalViewController:imagePickerControlleranimated:YES];
UINavigationBar *栏 = picker.navigationBar;
UINavigationItem *navItem = bar.topItem;
navItem.prompt = @"一些新的提示";
Someone answered this for me on the Apple dev forums:
UINavigationBar *bar = picker.navigationBar;
UINavigationItem *navItem = bar.topItem;
navItem.prompt = @"Some new prompt";
I wasn't correctly accessing the navbar.
Use the code after calling 'presentModalViewController'.....like below...
[controller presentModalViewController:imagePickerController animated:YES];
UINavigationBar *bar = picker.navigationBar;
UINavigationItem *navItem = bar.topItem;
navItem.prompt = @"Some new prompt";