简体   繁体   English

子视图更改时,更改NSSplitView中的分隔符位置

[英]Change divider positions in NSSplitView when subviews change

I have an NSSplitView with four subviews. 我有一个带有四个子视图的NSSplitView Each subview has a header with some text and an on/off checkbox, and below it an NSTableView . 每个子视图都有一个带有一些文本的标题和一个开/关复选框,下面是一个NSTableView The user can toggle visibility of the table by using the checkbox. 用户可以使用复选框切换表的可见性。

If the table is visible at program start, and the user deselects the checkbox, the table disappears. 如果在程序启动时表格可见,并且用户取消选中该复选框,则表格将消失。 The subview thus becomes a lot smaller. 因此子视图变得更小。

How do I make my NSSplitView react to this (by adjusting the dividers)? 如何让NSSplitView作出反应(通过调整分隔线)?

要以编程方式设置分隔符的位置,请在NSSplitView上调用-setPosition:ofDividerAtIndex : .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM