문제

This should be straightforward but I couldn't find anything on either SO or Google on this topic so..

What's the best way of zooming new document windows to full screen (i.e. not the full screen mode but just maximizing the window) for NSDocument based apps?

It might even be some method to override in NSDocument or NSWindowController but I'm unable to locate it. Or are we supposed to do this manually somewhere in the initWithType:error: method..?

도움이 되었습니까?

해결책

Use performZoom: to simulate clicking your window's green "Zoom" button.

Your window gets the zoom size from windowWillUseStandardFrame:defaultFrame:. Return a modified NSRect, there, to zoom to a size other than the default zoomed frame.

- (void)windowDidLoad {
    [super windowDidLoad];

    [self.window performZoom:self];
}

- (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)newFrame {
    // Implement a custom zoomed window size here, or return the default zoomed size.
    return newFrame;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top