Created
June 23, 2015 11:48
-
-
Save bartjacobs/f517767dcca8b1899683 to your computer and use it in GitHub Desktop.
layoutSubviews
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
- (void)layoutSubviews { | |
[super layoutSubviews]; | |
// Helpers | |
CGRect bounds = self.contentView.bounds; | |
// Update Frames | |
CGRect frameTextLabel = self.textLabel.frame; | |
CGRect frameDetailTextLabel = self.detailTextLabel.frame; | |
CGRect frameActivityIndicatorView = self.activityIndicatorView.frame; | |
frameTextLabel.origin.y = 0.0; | |
frameTextLabel.origin.x = kTextLabelMarginLeft; | |
frameTextLabel.size.height = CGRectGetHeight(bounds); | |
frameTextLabel.size.width = (CGRectGetWidth(bounds) - kTextLabelMarginLeft - kTextLabelMarginRight); | |
[self.textLabel setFrame:frameTextLabel]; | |
frameDetailTextLabel.origin.y = 0.0; | |
frameDetailTextLabel.origin.x = kDetailTextLabelMarginRight; | |
frameDetailTextLabel.size.height = CGRectGetHeight(bounds); | |
frameDetailTextLabel.size.width = (CGRectGetWidth(bounds) - kDetailTextLabelMarginLeft - kDetailTextLabelMarginRight); | |
[self.detailTextLabel setFrame:frameDetailTextLabel]; | |
frameActivityIndicatorView.origin.y = ceilf(CGRectGetMidY(bounds) - (CGRectGetHeight(frameActivityIndicatorView) / 2.0)); | |
frameActivityIndicatorView.origin.x = CGRectGetWidth(bounds) - CGRectGetWidth(frameActivityIndicatorView) - kActivityIndicatorViewMarginRight; | |
[self.activityIndicatorView setFrame:frameActivityIndicatorView]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment