dkduck/FLKAutoLayout — pull request #4 by rhgills (2013-07-01 22:23:51+00:00)
Title: Add View Hierarchy Traversal to Remove Constraints

### `removeConstraintsFromApplicableSuperview:`
Added `removeConstraintsFromApplicableSuperview:`, which traverses through all the superviews of the receiver to remove each passed constraint from the nearest superview that holds it. This means that you can remain blissfully unaware of which superview FLKAutoLayout is adding constraints to when constraining a view, yet still remove them by calling it on either of the views that you used to configure the constraints.

I discovered the need for this method when implementing a container view controller. When that container switches the single contained view controller it holds, I wanted to remove all constraints it configured on the previously contained view controller's view before removing it from the view hierarchy. In this case, I use it as follows:

- (void)makeViewControllerInactive:(UIViewController *)inactiveViewController
{
[inactiveViewController willMoveToParentViewController:nil];
[inactiveViewController removeFromParentViewController];

[[inactiveViewController view] removeConstraintsFromApplicableSuperview:self. activeViewControllerPositioningConstraints];
self.activeViewControllerPositioningConstraints = nil;

[[inactiveViewController view] removeFromSuperview];
[inactiveViewController didMoveToParentViewController:nil];
}

When setting constraints on the activeViewController in `updateViewConstraints`, I populate the array of activeViewControllerPositioningConstraints.

### Unit Tests
I also took the opportunity to add a unit test target and wrote some tests to drive out the implementation of `removeConstraintsFromApplicableSuperview:`. Hopefully this will encourage others to improve the test coverage going forward.

### Repo Structure
And, as part of adding the unit test target, I messed with the repository directory structure a bit (hopefully for the better). I hope I'm not stepping on your toes too much here. Please do let me know your thoughts on both the organizational changes I made and the more substantial ones.