Created
April 10, 2013 16:00
-
-
Save jcromartie/5355959 to your computer and use it in GitHub Desktop.
This file contains 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
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; | |
[titleLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; | |
[titleLabel setNumberOfLines:0]; | |
[titleLabel setLineBreakMode:NSLineBreakByWordWrapping]; | |
[titleLabel setFont:[USNTheme smallTitleFont]]; | |
[self addSubview:titleLabel]; | |
[self setTitleLabel:titleLabel]; | |
UILabel *summaryLabel = [[UILabel alloc] initWithFrame:CGRectZero]; | |
[summaryLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; | |
[summaryLabel setNumberOfLines:0]; | |
[summaryLabel setLineBreakMode:NSLineBreakByWordWrapping]; | |
[summaryLabel setFont:[USNTheme smallTextFont]]; | |
[self addSubview:summaryLabel]; | |
[self setSummaryLabel:summaryLabel]; | |
NSDictionary *views = NSDictionaryOfVariableBindings(titleLabel, summaryLabel); | |
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-[titleLabel]-|" | |
options:nil | |
metrics:nil | |
views:views]]; | |
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-[summaryLabel]-|" | |
options:nil | |
metrics:nil | |
views:views]]; | |
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[titleLabel]-[summaryLabel]" | |
options:nil | |
metrics:nil | |
views:views]]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment