Re: NSSplitView similar to Xcode's editor/debug area split view
Re: NSSplitView similar to Xcode's editor/debug area split view
- Subject: Re: NSSplitView similar to Xcode's editor/debug area split view
- From: Andy Lee <email@hidden>
- Date: Fri, 28 Jun 2013 07:58:31 -0400
Hi Chuck,
On Jun 26, 2013, at 8:30 PM, Chuck Soper <email@hidden> wrote:
> 2. How should I animate the showing or hiding of the 'debug area' view?
I do by sending setFrame: to the two subviews' animator proxies instead of to the view itself.
// Assumes the split view has two subviews, one above the other.
- (void)_setTopSubviewHeight:(CGFloat)newHeight
forTwoPaneSplitView:(NSSplitView *)splitView
animate:(BOOL)shouldAnimate
{
NSView *viewOne = [[splitView subviews] objectAtIndex:0];
NSRect frameOne = [viewOne frame];
NSView *viewTwo = [[splitView subviews] objectAtIndex:1];
NSRect frameTwo = [viewTwo frame];
frameOne.size.height = newHeight;
frameTwo.size.height = ([splitView bounds].size.height
- [splitView dividerThickness]
- newHeight);
if (shouldAnimate)
{
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:0.1];
{{
[[viewOne animator] setFrame:frameOne];
[[viewTwo animator] setFrame:frameTwo];
}}
[NSAnimationContext endGrouping];
}
else
{
[viewOne setFrame:frameOne];
[viewTwo setFrame:frameTwo];
}
}
There may be a better way, but this seems to work.
--Andy
_______________________________________________
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