Hi Chuck,

On Jun 26, 2013, at 8:30 PM, Chuck Soper <chu...@veladg.com> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to