Last active
December 10, 2015 03:38
-
-
Save nenadvulic/4375865 to your computer and use it in GitHub Desktop.
Get correct UILabe height with NSAttributedString
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
CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((__bridge CFAttributedStringRef)activityLbl.attributedText); | |
CGSize targetSize = CGSizeMake(YOUR_WIDTH, CGFLOAT_MAX); | |
CGSize fitSize = CTFramesetterSuggestFrameSizeWithConstraints(framesetter, CFRangeMake(0, [activityLbl.attributedText length]), NULL, targetSize, NULL); | |
CFRelease(framesetter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment