如何将导航栏的“完成”按钮添加到弹出窗口的 passthroughViews 中?
我正在使用一个 iPad 应用程序,该应用程序有一个分割视图,详细视图中有一个导航控制器。导航堆栈中最深的视图是编辑视图,用户可以在其中编辑数据。我将编辑按钮作为 rightBarButtonItem,并在编辑开始时将其更改为完成按钮。
当编辑开始并且用户触摸特定字段时,我会呈现一个弹出概览,其中包含根据他们键入的内容过滤的可能选项列表 - 一种基于所有其他对象中该字段的所有值的自动填充形式。
除非您尝试触摸“完成”按钮,否则效果很好。弹出窗口吃掉了这种接触并自行消失。因此用户必须再次触摸“完成”。
我尝试使用 uipopovercontroller 的 passthroughViews 属性,但 UIBarButtonItem 不是视图,并且没有记录的方法来获取完成按钮甚至导航栏的视图。我可以在 gdb 中访问该变量,但无法通过 KVC 访问它。
关于如何防止需要点击完成两次有什么想法吗?
我考虑过在窗口上安装一个手势识别器,但这看起来很混乱,而且我必须处理旋转。
I'm working in an iPad app that has a split view with a navigation controller in the detail view. The deepest view that can be in the navigation stack is an edit view where the user can edit data. I put an edit button as the rightBarButtonItem and when editing starts, change it to a done button.
When editing commences and the user touches on a particular field, I present a popoverview with a list of possible choices filtered by what they are typing - a form of autofill based on all the values of that field in all other objects.
This works fine, except if you try touching on the done button. The popover eats this touch and dismisses itself. So the user has to touch done again.
I tried using the uipopovercontroller's passthroughViews property, but UIBarButtonItem is not a view and there is no documented way to get the view for the done button or even the navigation bar. I can access the variable in gdb, but it isn't accessible via KVC.
Any ideas on how I can prevent the need to tap done twice?
I've thought about a gesture recognizer on the window, but that seems messy and I'd have to handle rotation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果有人从谷歌到达这里,请从其他问题复制粘贴:
我现在找到的唯一解决方案是使用自定义 UIButton 创建 UIBarButtonItem
,然后使用,
但要做好准备 - 你不能创建看起来像 UIBarButtoItem 的 UIButton。我最终创建了重新组装 UIBarButtonItem 的图像。
In case anyone gets here from google, copypaste from other question:
The only solution I found for now is to create UIBarButtonItem with custom UIButton using
and then
But be prepared - you cannot create UIButton that looks like UIBarButtoItem. I ended up with creating image that reassembled UIBarButtonItem.