如果我从应用程序中更改NSToolbar的大小,例如通过缩小大小、图标和文本,该应用程序会出现不满足约束条件的错误(尝试关闭自动布局或让应用程序生成其布局)。
我的窗口包括一个工具栏和左/右两个视图。
[81687:303] Unable to simultaneously satisfy constraints:
(
"<NSAutoresizingMaskLayoutConstraint:0x100635620 h=--& v=--& V:[NSToolbarItemViewer:0x101b4d930(5)]>",
"<NSAutoresizingMaskLayoutConstraint:0x100634b30 h=--& v=-&- V:|-(11)-[_NSToolbarSpace:0x101b49a00] (Names: '|':NSToolbarItemViewer:0x101b4d930 )>",
"<NSAutoresizingMaskLayoutConstraint:0x100634ad0 h=--& v=-&- V:[_NSToolbarSpace:0x101b49a00]-(12)-| (Names: '|':NSToolbarItemViewer:0x101b4d930 )>"
)
Will attempt to recover by breaking constraint
<NSAutoresizingMaskLayoutConstraint:0x100634b30 h=--& v=-&- V:|-(11)-[_NSToolbarSpace:0x101b49a00] (Names: '|':NSToolbarItemViewer:0x101b4d930 )>
Set the NSUserDefault NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints to YES to have -[NSWindow visualizeConstraints:] automatically called when this happens. And/or, break on objc_exception_throw to catch this in the debugger.
当我看到约束错误时
编辑:看起来“工具栏空间项”破坏了约束,如果我将其移除,它就可以正常运行。