调整大小时 NSWindow 标题栏变白

发布于 2024-09-13 04:16:42 字数 764 浏览 0 评论 0原文

我正在以编程方式调整包含 NSOpenGLViewNSWindow 的大小。窗口调整大小,NSOpenGLView 正在处理调整大小的问题,但 NSWindow 的标题栏变成完全白色。但是,可以单击按钮(最小化,...),但您也看不到它们。

在 Windows 控制器中使用以下代码来调整大小。该方法在主线程上调用。

-(void)setHeightAndWithToWindow:(NSArray*)heightWidth{
    int width = [(NSNumber*)[heightWidth objectAtIndex:0] intValue];
    int height = [(NSNumber*)[heightWidth objectAtIndex:1] intValue];
    NSRect rect = NSMakeRect(0, 0, width ,height);
    if([window frame].size.height != (rect.size.height - [self titleBarHeight]) ||
        [window frame].size.width != rect.size.width){ 
        [window setFrame:rect display:false animate:true];
    }
}

标题栏变白并且不再自行绘制可能是什么原因?您可以让标题栏自行绘制作为解决方法吗?

谢谢

I'm programatically resizing my NSWindow containing an NSOpenGLView. The window resizes, the NSOpenGLView is handling the resizing fine, but the titlebar of the NSWindow turns completely white. However the buttons (minimize,...) can be clicked, also you can not see them.

Resizing occurs using the following code in the windows controller. The method is called on the main thread.

-(void)setHeightAndWithToWindow:(NSArray*)heightWidth{
    int width = [(NSNumber*)[heightWidth objectAtIndex:0] intValue];
    int height = [(NSNumber*)[heightWidth objectAtIndex:1] intValue];
    NSRect rect = NSMakeRect(0, 0, width ,height);
    if([window frame].size.height != (rect.size.height - [self titleBarHeight]) ||
        [window frame].size.width != rect.size.width){ 
        [window setFrame:rect display:false animate:true];
    }
}

What could be the reason, that the title bar turns white and does not draw itself again? Can you tell the title bar to draw itself as a workaround?

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自由如风 2024-09-20 04:16:42

听起来你的 OpenGLView 太大了。当您发送[self titleBarHeight]时,self是什么?这段代码是在窗口子类中还是其他东西中?

Sounds like you made your OpenGLView too big. When you send [self titleBarHeight], what is self? Is this code in a window subclass or something else?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文