Re: NSSplitView resizing
Re: NSSplitView resizing
- Subject: Re: NSSplitView resizing
- From: Oftenwrong Soong <email@hidden>
- Date: Wed, 26 Aug 2009 20:55:30 -0700 (PDT)
On Wednesday, August 26, 2009 8:22:24 PM, Brandon Walkin <email@hidden> wrote:
> This can be done completely in IB if you use BWToolkit. http://brandonwalkin.com/bwtoolkit/
>
> Demo video: http://brandonwalkin.com/blog/videos/iCalSplitView.mov
>
> Brandon
Wow, that is a *really* impressive control! Thanks for the video and for pointing out your toolkit. I'll be checking it out.
In this app my needs are very limited (for now at least!) so I implemented a simple delegate method. Everyone's input helped tremendously. Thanks to everyone who posted:
- (void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize:(NSSize)oldSize
{
NSRect newFrame = [sender frame];
NSArray * subviews = [sender subviews];
CGFloat dividerThickness = [sender dividerThickness];
NSView * leftView = [subviews objectAtIndex:0];
NSRect leftFrame = [leftView frame];
NSView * rightView = [subviews objectAtIndex:1];
NSRect rightFrame = [rightView frame];
// Height always follows split view
leftFrame.size.height = rightFrame.size.height = newFrame.size.height;
// Width of left frame is left untouched; All width resizing occurs in right frame
rightFrame.size.width = newFrame.size.width - leftFrame.size.width - dividerThickness;
// Post our changes
[leftView setFrame:leftFrame];
[rightView setFrame:rightFrame];
}
_______________________________________________
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