Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在一个班级工作,该班级是另一个班级的代表;这个其他类位于第三方库中,我想尽可能避免更改。
原始类正在处理 -touchesEnded 事件,并将责任委托给我,但它不会将 UIEvent 本身传递给我。有没有办法处理正在进行的当前事件?这是一个双击处理程序,传递给我的只是被触摸的视图,以及触摸发生的点。我想确切地知道该事件涉及多少次触摸。
谢谢!兰迪
您可以子类化原始的 3rd-party 视图并-touchesEnded:withEvent:在该子类中覆盖。
-touchesEnded:withEvent:
您还可以继承 UIApplication 并覆盖其-sendEvent:方法以捕获所有(公共)事件。
-sendEvent: