iPhone:无法识别 UIButton 上的多次触摸
我有一个 UIButton(实际上是 UIButton 的子类),它通过 TouchsBegan: 和 TouchMoved: 函数与用户交互。
我希望用户能够按下按钮,将手指拖开,然后让第二根手指触摸按钮(而第一根手指从未离开过屏幕)。
问题是,第二个触摸事件永远不会调用touchesbegan:除非第一个手指已被释放。
有什么方法可以克服这个问题,还是我试图做不可能的事?
I have a UIButton (a subclass of one, actually) that interacts with the user via the touchesbegan: and touchesmoved: functions.
What I would like is for the user to be able to press down the button, drag their finger away, and have a second finger touch the button (all while the first finger has never left the screen).
Problem is, the second touch event never calls touchesbegan: unless the first finger has been released.
Is there some way to override this, or am I trying to do the impossible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试将
multipleTouchesEnabled
设置为YES?Have you tried setting
multipleTouchesEnabled
to YES?如果交互使用
touchesbegan:
和touchesmoved:
,则使用 UIView 而不是UIButton
。按钮是 UIControl,与 UIControls 交互的方式是我不确定这两种获取事件的方式能否很好地混合。
If the interactions are using
touchesbegan:
andtouchesmoved:
then use a UIView instead of aUIButton
. A button is a UIControl, and the way to interact with UIControls isI'm not sure this two ways of getting events mix well.