更改 NSPanel 中的标题栏高度
我正在尝试更改 NSPanel 的标题栏高度。我尝试了以下操作,但没有按预期工作:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSRect f = [[[window contentView] superview] frame];
f.size.height += 10;
[[window contentView] superview].frame = f;
}
I'm trying to change the titlebar height of an NSPanel. I tried the following but it didn't work as expected:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSRect f = [[[window contentView] superview] frame];
f.size.height += 10;
[[window contentView] superview].frame = f;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法更改窗口标题栏的高度。它是由框架固定的。如果您想要一个具有自定义外观的窗口,您需要使用
NSBorderlessWindowMask
样式掩码创建一个窗口,然后绘制您自己的标题栏和小部件。You can't change the height of a window's title bar. It's fixed by the framework. If you want a window with a custom appearance you'll need to create a window using the
NSBorderlessWindowMask
style mask and then draw your own title bar and widgets.