I've been trying to implement a splitview with animated collapse/uncollapse of one of its subviews. So far without success, although I think I'm very close to a working solution. There's a lot of documentation and sample code on the internet, but none of what I have found seems to fit my needs.
Currently, this is the code that does the animation (in a NSSplitView subclass) : - (void)animateDividerToPosition:(CGFloat)dividerPosition { NSView *view0 = [[self subviews] objectAtIndex:0]; NSView *view1 = [[self subviews] objectAtIndex:1]; NSRect view0Rect = [view0 frame]; NSRect view1Rect = [view1 frame]; NSRect overalRect = [self frame]; CGFloat dividerThickness = [self dividerThickness]; if ([self isVertical]) { view0Rect.size.width = dividerPosition; view1Rect.origin.x = dividerPosition + dividerThickness; view1Rect.size.width = overalRect.size.width - view0Rect.size.width - dividerThickness; } else { view0Rect.size.height = dividerPosition; view1Rect.origin.y = dividerPosition + dividerThickness; view1Rect.size.height = overalRect.size.height - view0Rect.size.height - dividerThickness; } [NSAnimationContext beginGrouping]; [[NSAnimationContext currentContext] setDuration:0.3]; [[view0 animator] setFrame: view0Rect]; [[view1 animator] setFrame: view1Rect]; [NSAnimationContext endGrouping]; } Collapse seems to work fine this way, but when I uncollapse a subview, the views contents are only drawn partially, similar to the effect one sees when the splitview delegate does not implement the methods to constrain the subview size. Any ideas? Thanks -- Luc Van Bogaert _______________________________________________ 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