Hide the dock programmatically on Mac OS X
I am working on a new software for Mac OS X Snow Leopard, and one of the features I need to 开发者_开发百科implement is when my application starts, hide the Dock completely and block Spotlight from working while the application is running. Anyone knows if this is possible and how to do it?
I agree with comment - "don't be evil".
And considering you won't be evil, this can be your solution.
try this, not sure about spotlight, but this has the dock and menu bar hiding.
Use OS X Kiosk Mode
https://developer.apple.com/library/mac/technotes/KioskMode/Introduction/Introduction.html
Use the bitmask NSApplicationPresentationOptions
to enable the Kiosk Mode options you would like to use.
For your specific request, "hide the Dock completely and block Spotlight from working while the application is running."
NSApplicationPresentationHideDock
Dock is entirely unavailable. Spotlight menu is disabled.
- (void)awakeFromNib {
@try {
NSApplicationPresentationOptions options = NSApplicationPresentationHideDock;
[NSApp setPresentationOptions:options];
}
@catch(NSException * exception) {
NSLog(@"Error. Make sure you have a valid combination of options.");
}
}
精彩评论