【问题标题】:NSSplitView programmatically Change SizeNSSplitView 以编程方式更改大小
【发布时间】:2014-06-12 13:20:19
【问题描述】:

我想知道是否可以通过编程方式更改拆分器的位置。

【问题讨论】:

  • 你试过什么?您是否尝试过调整窗格内子视图的大小?

标签: cocoa nssplitview


【解决方案1】:

您可以使用setPosition:ofDividerAtIndex:更改分隔线的位置

【讨论】:

    【解决方案2】:

    感谢您的快速回复...

    为了兴趣,我在途中发现了这个(可能对其他人有用)

    谢谢...为了感兴趣,我在路上发现了这个(可能对其他人有用),我在这里找到了:on Github

    - (CGFloat)positionOfDividerAtIndex:(NSInteger)dividerIndex {
    
        while (dividerIndex >= 0 && [self isSubviewCollapsed:[[self subviews] objectAtIndex:dividerIndex]])
            dividerIndex--;
    
        if (dividerIndex < 0)
            return 0.0f;
    
        NSRect priorViewFrame = [[[self subviews] objectAtIndex:dividerIndex] frame];
    
        return [self isVertical] ? NSMaxX(priorViewFrame) : NSMaxY(priorViewFrame);
    }
    

    我个人使用了-(float),所以请使用您的船“漂浮”的任何一个:D

    【讨论】:

      猜你喜欢
      • 2011-07-08
      • 2013-09-06
      • 2015-08-10
      • 1970-01-01
      • 1970-01-01
      • 2012-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多