Last active
July 27, 2016 22:14
-
-
Save bdalziel/90cc6f7879c69f003fde89c14e1e5c91 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
// https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITraitEnvironment_Ref/#//apple_ref/occ/intfm/UITraitEnvironment/traitCollectionDidChange: | |
-(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { | |
[super traitCollectionDidChange:previousTraitCollection]; | |
[self handleMargins:self.traitCollection]; | |
} | |
- (void)renderHeatIntoCell:(ASPFantasyPickemGame *)fantasyGame athleteId:(NSString *)athleteId eventId:(NSString *)eventId roundNumber:(NSString *)roundNumber rosterSlot:(NSString *)rosterSlot traitCollection:(UITraitCollection *)contextTraitCollection | |
{ | |
// Cell setup/rendering | |
[self handleMargins:contextTraitCollection]; | |
} | |
- (void)handleMargins:(UITraitCollection *)traitCollection { | |
CGFloat tinyMargin = [ASPSpacingUtil getSpacing:ASPSpacingSizeTiny traitCollection:self.traitCollection]; | |
CGFloat smallMargin = [ASPSpacingUtil getSpacing:ASPSpacingSizeSmall traitCollection:self.traitCollection]; | |
CGFloat topMargin = smallMargin - [ASPFontUtil topUIBaselineAdjustment:ASPUITextElementFantasyAthleteProfileHeatSummary traitCollection:traitCollection]; | |
CGFloat bottomMargin = smallMargin - [ASPFontUtil bottomUIBaselineAdjustment:ASPUITextElementFantasyAthleteProfileHeatPoints traitCollection:traitCollection]; | |
self.layoutMargins = UIEdgeInsetsZero; | |
self.contentView.layoutMargins = UIEdgeInsetsMake(0, 0, tinyMargin, 0); | |
self.contentCard.layoutMargins = UIEdgeInsetsMake(topMargin, smallMargin, bottomMargin, smallMargin); | |
self.constraintHeatPointsTop.constant = tinyMargin - [ASPFontUtil bottomUIBaselineAdjustment:ASPUITextElementFantasyAthleteProfileHeatSummary traitCollection:traitCollection] - [ASPFontUtil topUIBaselineAdjustment:ASPUITextElementFantasyAthleteProfileHeatPoints traitCollection:traitCollection]; | |
[self layoutMarginsDidChange]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment