NSBox 和自动布局

NSBox and Auto Layout

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

NSBox 是在 Interface Builder 中创建的,不适用于自动布局。它不会调整任何子视图的大小。

当使用 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.

rdar://47701604