xcode NSSplitView 只让一个面板在使用自动布局调整窗口大小时展开?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17648197/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
NSSplitView make only one panel expand on window resize using auto-layout?
提问by Daniel Farrell
Is it possible to achieve the following just using the auto-layout options available from Xcode? For example by changing hugging or compression settings.
是否可以仅使用 Xcode 提供的自动布局选项来实现以下目标?例如,通过更改拥抱或压缩设置。
What is the recommended way of achieving this resize behaviour?
实现这种调整大小行为的推荐方法是什么?
回答by Thomas Zoechling
If you want to achieve a fixed left panel, just select the left view in Interface Builder an choose "Editor" → "Pin" → "Width". This will make the divider unmovable, though.
如果要实现固定的左侧面板,只需在 Interface Builder 中选择左侧视图,然后选择“编辑器”→“引脚”→“宽度”。但是,这将使分隔器无法移动。
If you want to keep a draggable divider, you can use the "Holding Priorities" slider in IB.
To prioritize growth of the right panel, select the split view in IB and lower the "Right" holding priority to 1.
Note that those priorities have been added in Mountain Lion. Details can be found in the 10.8 AppKit release notes.
如果你想保留一个可拖动的分隔线,你可以使用 IB 中的“Holding Priorities”滑块。要优先考虑右侧面板的增长,请在 IB 中选择拆分视图并将“右侧”保持优先级降低为 1。
请注意,这些优先级已在 Mountain Lion 中添加。详细信息可以在10.8 AppKit 发行说明中找到。
If you need to support 10.7, achieving this NSSplitView behavior might be way harder. Apple fixed several bugs and shortcomings with 10.8 (especially in conjunction with split views).
如果您需要支持 10.7,实现这种 NSSplitView 行为可能会更难。Apple 在 10.8 中修复了几个错误和缺点(特别是与拆分视图结合使用)。