Reputation: 1681
Example when you double-click Xcode's toolbar, Xcode will automatically goes full screen (still show's menubar). How I can achieve same result programmatically using storyboards and Xcode 7 GM?
Upvotes: 2
Views: 2758
Reputation: 960
Here is the swift 5 version. In viewWillAppear() function of you view controller, call this function.
func setWindowFrameAndCenter() {
guard let window = self.view.window,
let windowScreenFrame = window.screen?.visibleFrame else {
return
}
window.setFrame(windowScreenFrame,
display: false,
animate: false)
window.center()
}
Upvotes: 2
Reputation: 281
In Objective C:
[self.window setFrame:NSScreen.mainScreen.visibleFrame display: true animate: true];
Upvotes: 0
Reputation: 70096
This mode is not called "full screen" but "zoomed".
You can "zoom" a window to the max available space by using the NSScreen visible frame as the target frame.
Let's say window
is your NSWindow IBOutlet:
window.setFrame(NSScreen.mainScreen()!.visibleFrame, display: true, animate: true)
Upvotes: 6