I have an interface designed as below set up with auto layout in the XIB.
[Left Pane]-[Center Pane]-[Right Pane]
[ Bottom Pane ]
Currently it supports max and min widths/heights for each of the panes as well as collapsing subviews by either double clicking on the divider or with a NSSegmentedControl. What I would like to do now is to animate the collapse that occurs when a user toggles the NSSegmentedControl. I have seen many examples of setting up animation with NSSplitView for collapsing a sub-view but none that accomplish it using Auto Layout.
I have tried to follow the demo for animating constraints provided in the WWDC 2012 video on Auto Layout Demo's. But as this is my first time enabling Auto Layout I have not yet figured out how to do it.
Below is what I currently have
NSArray *constraints = [self.leftPane constraints];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"firstAttribute = %d", NSLayoutAttributeWidth];
NSArray *filteredArray = [constraints filteredArrayUsingPredicate:predicate];
[self.leftPane removeConstraints:filteredArray];
[self.lcrSplitView layoutSubtreeIfNeeded];
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
[context setAllowsImplicitAnimation:YES];
NSLayoutConstraint *newWidth = [NSLayoutConstraint constraintWithItem:self.leftPane
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:0.0f
constant:0.0f];
[self.leftPane addConstraint:newWidth];
[self.lcrSplitView layoutSubtreeIfNeeded];
} completionHandler:^{}];