Created
January 28, 2013 20:06
-
-
Save atombender/4658565 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) updateConstraints { | |
NSMutableDictionary* views = [NSMutableDictionary new]; | |
[views setObject: textView forKey: @"textView"]; | |
[views setObject: resultTableView forKey: @"resultTableView"]; | |
[self removeConstraints: [self constraints]]; | |
[self addConstraints: [NSLayoutConstraint constraintsWithVisualFormat: | |
@"H:|-15-[textView(>=100)]-15-|" | |
options: 0 | |
metrics: nil | |
views: views]]; | |
if ([resultTableView isHidden]) { | |
[self addConstraints: [NSLayoutConstraint constraintsWithVisualFormat: | |
@"V:|-15-[textView(>=20)]-15-|" | |
options: 0 | |
metrics: nil | |
views: views]]; | |
} else { | |
[self addConstraints: [NSLayoutConstraint constraintsWithVisualFormat: | |
@"H:|-15-[resultTableView(>=100)]-15-|" | |
options: 0 | |
metrics: nil | |
views: views]]; | |
[self addConstraints: [NSLayoutConstraint constraintsWithVisualFormat: | |
@"V:|-15-[textView(>=20)]-10-[resultTableView]-15-|" | |
options: 0 | |
metrics: nil | |
views: views]]; | |
} | |
[super updateConstraints]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment