Created
October 22, 2016 16:56
-
-
Save bdalziel/92de07e051d334fbd2560ce78f4460fb 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)getUITextElementAboveBaselineHeight:(ASPUITextElement)element traitCollection:(UITraitCollection *)contextTraitCollection { | |
ASPUITextStyle elementTextStyle = [self mapUIElementToStyle:element elementVariation:ASPUITextElementVariationDefault]; | |
UIFont *font = [ASPFontUtil getUIFont:elementTextStyle traitCollection:contextTraitCollection]; | |
CGFloat lineHeightMultiple = [self getUILineHeightMultiple:elementTextStyle font:font traitCollection:contextTraitCollection]; | |
CGFloat lineHeightAdjustment = 0.0; | |
if (lineHeightMultiple != 1) { | |
lineHeightAdjustment = (font.lineHeight - (font.lineHeight * lineHeightMultiple))/2; | |
} | |
return font.ascender - lineHeightAdjustment; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment