NSSplitView with multiple dividers
NSSplitView with multiple dividers
- Subject: NSSplitView with multiple dividers
- From: Geoffrey Holden <email@hidden>
- Date: Sun, 19 Sep 2010 18:14:10 +0100
I am trying to set up a window with three resizable panes. Currently,
I have done this by dragging an NSSplitView into my window (in IB) and
then dragging another NSSplitView into that:
+NSSplitView
|--+NSView
| '-NSTableView
|
|--+NSView
| '-NSSplitView
|
Having done this, I am trying to constrain the minimum and maximum
sizes for each pane. Whilst Googling, I came across the following
tutorial on the excellent Cocoa with Love site http://cocoawithlove.com/2009/09/nssplitview-delegate-for-priority-based.html
I used the following code (taken from the tutorial) and it worked
perfectly - but only for the left hand pane. I suspect that this
might be because I don't have an NSSplitView with three sections. My
question is, how can I set up an NSSplitView with three sections? Can
I do it in IB or do I need to do it programatically? If My nested
NSSplitView is correct way of creating a three section splitview, how
can I make the code work?
- (CGFloat)splitView:(NSSplitView *)sender
constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:
(NSInteger)offset
{
NSView *subview = [[sender subviews] objectAtIndex:offset];
NSRect subviewFrame = subview.frame;
CGFloat frameOrigin;
if ([sender isVertical])
{
frameOrigin = subviewFrame.origin.x;
}
else
{
frameOrigin = subviewFrame.origin.y;
}
CGFloat minimumSize =
[[lengthsByViewIndex objectForKey:[NSNumber
numberWithInteger:offset]]
doubleValue];
return frameOrigin + minimumSize;
}
I daresay that the example project on CocoawithLove might answer my
queries - but, since it doesn't seem to download, I'm resorting to
asking the experts.
Thank you for your time.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden