【问题标题】:Passing Click Through Transparent Window通过透明窗口传递点击
【发布时间】:2013-07-30 15:04:38
【问题描述】:

我有一个全屏透明窗口。当用户单击它时,我希望将单击发送到窗口下方的内容。我该怎么做?

【问题讨论】:

    标签: macos cocoa click nswindow objective-c-2.0


    【解决方案1】:

    将 IgnoresMouseEvents 设置为 YES 应该可以解决问题..

    • (void)setIgnoresMouseEvents:(BOOL)ignoreMouseEvents

    指定窗口是否对鼠标点击和其他鼠标事件透明,允许覆盖窗口。

    http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html#//apple_ref/occ/instm/NSWindow/setIgnoresMouseEvents:

    【讨论】:

    • 谢谢,但是有问题。如果我将该属性设置为 YES,则不仅窗口会忽略鼠标事件,而且整个应用程序都会忽略(我在 NSApplication 子类中覆盖 -sendEvent:,但是当我设置 @987654325 时不再在鼠标左键单击时调用它@到NO。
    • 感谢这个答案,我解决了这个问题:stackoverflow.com/questions/1628366/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-04-23
    • 1970-01-01
    • 1970-01-01
    • 2015-09-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多