gpt4 book ai didi

macos - NSBox 和自动布局

转载 作者:行者123 更新时间:2023-12-03 17:31:10 24 4
gpt4 key购买 nike

尝试使用 NSBox 获取适用于深色模式的背景颜色,其行为与 NSView 不同。

NSBox 是在 Interface Builder 中创建的,不能与自动布局一起使用。它不会调整任何 subview 的大小。

最佳答案

使用Interface Builder > Editor > Embed In > Box时,存在错误。 NSBox autoresizesSubviews 属性设置为 NO,而不是 YES

When the value of this property is YES and the view’s frame changes, the view automatically calls the resizeSubviewsWithOldSize: method to facilitate the resizing of its subviews. When the value of this property is NO, the view does not autoresize its subviews. The default value of this property is YES.

雷达://47701604

Autoresizes subviews

关于macos - NSBox 和自动布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54478072/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com