开发者

NSWindow problem

开发者 https://www.devze.com 2023-03-09 19:23 出处:网络
Please help me. I set frame to the window like this: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {

Please help me. I set frame to the window like this:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application 
[window makeKeyWindow];
[window setFrame:NSMakeRect(0, 0, 1024, 768) display:YES];
[window setBackgroundColor:[NSColor clearColor]];
[window center];
}

But real window size: width = 1024, height = 620. I think because my screen size (1280x720).

So, when [window setContentView:myView], myView is d开发者_C百科isable a part.

I can't solve this problem. Please help me solve this.

Thanks.


Size your content view to fit the space available using -[NSWindow contentRectForFrameRect:]. You should also consider sizing your window's frame to fit the available space, as well, such as by using -[NSScreen visibleFrame]. Both the Dock and the menu bar eat some space, so you should not expect to have the full screen size available to your application.


If you want to show your window at the maximum size, have a look at NSWindow's -zoom: method

0

精彩评论

暂无评论...
验证码 换一张
取 消