iPhone:UIBarButtonItem 作为第一响应者?
是否只有继承自 UIControl
的类才能成为“第一响应者”? 我需要在导航栏中有一个按钮,使用 inputView/inputAccessoryView
属性调出 UIPickerView
。我知道我可以使用 UIBarButtonItem
的 customView
属性并创建自定义 UIButton
,但这需要“照片购物”来创建一个图像类似于 UIBarButtonItem
“完成”样式按钮(这就是我想要的)。
有什么建议吗/如果我可以让 UIBarButtonItem
成为第一响应者?
Is it only classes inheriting from UIControl
that can become "first responder"?
I need a button in the navigation bar that brings up a UIPickerView
using the inputView/inputAccessoryView
properties. I know that I can use the customView
property of the UIBarButtonItem
and create a custom UIButton
, but this would need "Photo Shopping" to create an image similar to the UIBarButtonItem
"Done" style button (which is what I want).
Any suggestions how/if I can get UIBarButtonItem
to become first responder?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基本上任何继承自 UIResponder 的类(不仅是 UIControl,还包括 UIView 子类)都可以成为第一响应者,但 UIBarButtonItem 继承自 UIBarItem 和 NSObject。因此它不能成为第一响应者。
出于好奇,您所做的事情不可能仅通过按按钮显示 UIPickerView 来实现吗?
Basically any class which inherits from UIResponder (not just UIControl, but also UIView subclasses) can become first responders, but UIBarButtonItem inherits from UIBarItem and NSObject. Hence it can not become the first responder.
Out of curiosity, what you are doing is not possible by just displaying the UIPickerView on a button press?