使用 UIPickerView 委托方法的问题
我有一个 UIPicker 并设置了我的委托方法。
我希望当用户点击选定的选择器项目时发生一些事情。处理方式:
- (void)pickerView:(UIPickerView *)aPickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
当选择选择器项而不是点击时触发事件发生。
当点击选定的选择器项目时,如何触发事件?
I have a UIPicker and have setup my delegate methods.
I want something to happen when the user TAPS on the selected picker item. Handling it in:
- (void)pickerView:(UIPickerView *)aPickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
Triggers the event to occur when the picker item is selected not tapped.
How can I trigger an event when the selected picker item is tapped?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须子类 UIPickerView 并手动检测那里的触摸。是的,看起来很乱。但这似乎是做到这一点的唯一方法。下面的代码可能会有所帮助,
参考:在UIPickerView而不是UIView中响应touchesBegan
You have to sub class UIPickerView and detect the touches there manually. Yes, it looks messy. But that seems to be the only way to do this. The below code may help,
Ref: Responding to touchesBegan in UIPickerView instead of UIView