Last active
October 22, 2016 16:36
-
-
Save bdalziel/7cf19a0dc6048c759382d1a37ce9ab1c 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
- (void)handleMargins:(UITraitCollection *)contextTraitCollection { | |
// 1. Get hold of a bunch of sizes based on the traits of the context we're rendering in | |
CGFloat deviceScale = [UIScreen mainScreen].scale; | |
CGFloat smallMargin = [ASPSpacingUtil getSpacing:ASPSpacingSizeSmall traitCollection:contextTraitCollection]; | |
CGFloat gutterWidth = [ASPSpacingUtil getGutterWidth:contextTraitCollection]; | |
CGFloat horizontalMargin = [ASPSpacingUtil getLeftAndRightCellMargins:contextTraitCollection]; | |
// 2. Setup containing margins | |
// Zero out cell margins, and set horizontal indent on contentview - important for the transition from full bleed to gutters (regular class sizes such as iPad portrait) | |
// Small margin bottom represents between cell padding. | |
self.layoutMargins = UIEdgeInsetsZero; | |
self.contentView.layoutMargins = UIEdgeInsetsMake(0, horizontalMargin, smallMargin, horizontalMargin); | |
// 3. Set card inner margins to position labels | |
self.contentCard.layoutMargins = UIEdgeInsetsMake(smallMargin, gutterWidth, smallMargin, gutterWidth); | |
// Rest of implementation to follow... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment