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.
我试图为可能有按钮的视图创建滑动机制。没有按钮它是小菜一碟。
但是,如果您的手指从按钮上开始,您可以触发一个事件(向外拖动),但这并不能告诉我方向。
那么如何检测手指从按钮开始的滑动/拖动方向?
有任何想法吗?
谢谢西蒙
只是不使用外部拖动事件仍然很容易。查看hitTest:withEventUIView 以确定它是否从按钮开始。连同 UISwipeGestureRecognizer (或触摸事件的东西)你应该没问题。
hitTest:withEvent
退房UISwipeGestureRecognizer。您应该能够将它添加到您的主视图并让它识别手势,无论它是否源自按钮。
UISwipeGestureRecognizer