单击桌面图标和doc项目从透明无边框窗口

时间:2013-12-04 06:39:56

标签: iphone objective-c macos cocoa xcode5

我有一个无边框且透明(alpha值为.5)的NSwindow,如下图所示。现在我必须从此窗口中单击doc和desktop项目 我研究谷歌,找不到相关的

任何人都可以告诉我如何实现这一目标。

下面的代码用于创建NSWindow enter image description here

NSRect screenRect = [[NSScreen mainScreen]frame];

captureItFullWindow = [[CapTureFullWindow alloc] initWithContentRect:screenRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO ];

[captureItFullWindow setLevel:NSScreenSaverWindowLevel];

[captureItFullWindow makeKeyAndOrderFront:self];

[captureItFullWindow setOpaque:NO];  //Tells the window manager that the window might have transparent parts.
[captureItFullWindow setBackgroundColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.3]];

1 个答案:

答案 0 :(得分:0)

当我得到答案时,它太容易了

只有我必须设置窗口鼠标忽略属性

[self setIgnoresMouseEvents:YES];