有没有办法绘制全屏覆盖,然后在其上绘制标签 + 文本字段?
我已经做了什么:
当用户单击按钮时,屏幕应被覆盖。
在我写的AppDelegate.m按钮操作方法中:
NSRect frame = [[NSScreen mainScreen] frame];
self.mainWindow = [[NSWindow alloc] initWithContentRect:frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
[self.mainWindow setAcceptsMouseMovedEvents:YES];
[self.mainWindow setOpaque:NO];
[self.mainWindow setLevel:CGShieldingWindowLevel()];
[self.mainWindow setBackgroundColor:[NSColor colorWithDeviceRed:0.0 green:0.0 blue:0.0 alpha:0.7]];
[self.mainWindow orderFrontRegardless];
NSApplicationPresentationOptions options = NSApplicationPresentationDisableProcessSwitching + NSApplicationPresentationHideDock + NSApplicationPresentationDisableForceQuit + NSApplicationPresentationDisableSessionTermination + NSApplicationPresentationDisableHideApplication;
[NSApp setPresentationOptions:options];
它工作得很好,但没有任何动画&我真的不知道如何在它上面绘制对象(标签/文本字段)?
要么,我应该将此方法移到另一个类中吗?