I am developing an application in which a toolbar can be displayed / hidden by the user with a button. The problem is this: If the user chooses to hide the toolbar and then enters full-screen mode, the toolbar is displayed.
The user interface was created programmatically (i.e. does not use Interface Builder).
This is creating a toolbar in an application delegate:
mainToolbar = [[NSToolbar alloc] initWithIdentifier:MAIN_TOOLBAR]; [mainToolbar setAllowsUserCustomization:NO]; [mainToolbar setDisplayMode:NSToolbarDisplayModeIconOnly]; [mainToolbar setDelegate:self]; [window setToolbar: mainToolbar];
These are the actions performed by the buttons:
-(void)hideToolbar { editing = YES; [mainToolbar setVisible:NO]; } -(void)showToolbar { editing = NO; [mainToolbar setVisible:YES]; }
I tried to fix this using the windowβs delegate methods, but still the toolbar is displayed when I enter full screen mode regardless of the editing value.
- (void)windowDidEnterFullScreen:(NSNotification *)notification { [mainToolbar setVisible:!editing];
}
- (void)windowDidExitFullScreen:(NSNotification *)notification { [mainToolbar setVisible:!editing];
}
Thank you very much in advance!
source share