Is there a way to draw fullscreen overlay, and then draw a label + textfield over it?
What I already did:
When user clicks button, screen should be covered by overlay.
in the AppDelegate.m button action method I wrote:
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];
It’s working nice, but without any animations & I really don’t know how to draw objects (labels/textfields) over it?
Either, should I move this method into another class?
as for animation, there are many ways.. Id do
as for the label, just add a NSTextField with a HUGE NSFont, as a subview
p.s. just like with the label, you can add any other views 🙂