3

I was wondering if there's a way you can programatically change the position of the splitter.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Adrian Sluyters
  • 2,186
  • 1
  • 16
  • 21

2 Answers2

5

You can change the position of the divider using setPosition:ofDividerAtIndex:

GoodSp33d
  • 6,252
  • 4
  • 35
  • 67
1

Thanks for the quick reply...

And for interest sake, I found this on the way (might be useful for others)

Thanks...And for interest sake, I found this on the way (might be useful for others) which I found here: 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);
}

I personally used -(float), so use whichever "floats" your boat :D

Adrian Sluyters
  • 2,186
  • 1
  • 16
  • 21