Reputation: 79
I am going to create one desktop application,in that I am trying to hide menu bar and dock i.e. full screen application that cover whole screen. Please help me.Thanks in advance.
Upvotes: 2
Views: 1393
Reputation: 2295
Try this:
- (void)toggleMyViewFullScreen:(id)sender
{
if (myView.inFullScreenMode) {
[myView exitFullScreenModeWithOptions:nil];
} else {
NSApplicationPresentationOptions options =
NSApplicationPresentationHideDock |
NSApplicationPresentationHideMenuBar;
[myView enterFullScreenMode:[NSScreen mainScreen] withOptions:@{
NSFullScreenModeApplicationPresentationOptions : @(options) }];
}];
}
}
You can connect this to the fullscreen menu item in the Window menu (after inserting that into your nib) but be sure to change the action that the menu item fires to your toggleMyViewFullScreen: . Or your can invoke toggleMyViewFullScreen programmatically or when your app loads.
Upvotes: 1
Reputation: 4274
Use following code...its simple...
[view enterFullScreenMode:[NSScreen mainScreen] withOptions:nil];
Upvotes: 1