Hi Luc, Attached is a split view controller which I think does what you want, or at least should enough to go on. This is cobbled together from various examples I found on the web. The code is experimental and probably needs some cleaning up.
Cheers, Martin
MHSlidingSplitViewController.h
Description: Binary data
MHSlidingSplitViewController.m
Description: Binary data
On Feb 5, 2012, at 09:59 PM, Luc Van Bogaert wrote: > 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/martin.hewitson%40aei.mpg.de > > This email sent to martin.hewit...@aei.mpg.de ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Martin Hewitson Albert-Einstein-Institut Max-Planck-Institut fuer Gravitationsphysik und Universitaet Hannover Callinstr. 38, 30167 Hannover, Germany Tel: +49-511-762-17121, Fax: +49-511-762-5861 E-Mail: martin.hewit...@aei.mpg.de WWW: http://www.aei.mpg.de/~hewitson ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________ 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