无法编辑 NSWindow 的工具栏 - Cocoa
所以我使用的方法是:
[someWindow setContentBorderThickness:24.0 forEdge:NSMaxYEdge];
但我似乎无法让工具栏增加高度。它只是与默认情况保持相同。任何人都可以在这里阐明一些情况吗?
So I'm using the method:
[someWindow setContentBorderThickness:24.0 forEdge:NSMaxYEdge];
But I can't seem to get the toolbar to increase in height. It simply stays the same as in default. Can anyone shed some light here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
NSToolbar
会自动调整大小以适应最高的NSToolbarItem
的高度。标准(大)工具栏项目的高度均为 32 px,因此工具栏无需增大。如果您执行添加自定义视图工具栏项目之类的操作,那么它将调整大小以适应该项目,如下图所示:(为了实现上面显示的结果,我在 IB 中单击工具栏两次以打开允许的工具栏项目表,然后将
NSView
自定义视图从库调色板拖到那张纸)。PS 我建议谨慎使用此功能。
An
NSToolbar
is automatically resized to accommodate the height of the tallestNSToolbarItem
. The standard (large) toolbar items are all 32 px tall, so the toolbar has no need to make itself larger. If you do something like add a custom view toolbar item, then it will be resized to accommodate that item, as shown in the image below:(To accomplish the result shown above, I clicked on the toolbar twice in IB to bring down the Allowed Toolbar Items sheet, then dragged an
NSView
custom view from the library palette onto that sheet).P.S. I'd recommend using this capability with discretion.
您不能为
NSToolbar
指定任意高度。但是,您可以指定尺寸模式。带有 24x24 像素图标的工具栏有一个小尺寸模式:相当于 Interface Builder 属性检查器中的 Size: Small。
You cannot specify an arbitrary height for
NSToolbar
. You can, however, specify a size mode. A toolbar with 24x24-pixel icons has a small size mode:which is equivalent to Size: Small in Interface Builder’s Attributes Inspector.