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.
在我的 Cocoa 应用程序中,我需要在非按键窗口中处理滑动手势。不幸的是,手势事件仅传递到键窗口。制作我的窗口键不是一种选择。
任何人都知道的任何解决方法?
我发现的唯一解决方法是让您的窗口视图监视 mouseEntered: 事件,并调用 NSApp 的 activateIgnoringOtherApps: 方法。不过,这不是标准行为。
感谢弗朗西斯的说明。我无法找到一种方法来做到这一点。相反,我只是使用了滚动视图的 scrollWheel: 事件并使用我自己的算法来检测滑动。不完美,但似乎工作正常。