Created
July 27, 2016 21:50
-
-
Save bdalziel/655d2a89e93de1c72a7e0f7e63adb4e6 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
+ (CGFloat)topUIBaselineAdjustment:(ASPUITextElement)element traitCollection:(UITraitCollection *)contextTraitCollection { | |
ASPUITextStyle elementTextStyle = [self mapUIElementToStyle:element]; | |
UIFont *font = [ASPFontUtil getUIFont:elementTextStyle traitCollection:contextTraitCollection]; | |
return floor(font.ascender - font.capHeight); | |
} | |
+ (CGFloat)bottomUIBaselineAdjustment:(ASPUITextElement)element traitCollection:(UITraitCollection *)contextTraitCollection { | |
ASPUITextStyle elementTextStyle = [self mapUIElementToStyle:element]; | |
UIFont *font = [ASPFontUtil getUIFont:elementTextStyle traitCollection:contextTraitCollection]; | |
return -(floor(font.lineHeight - font.ascender)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment