Last active
August 29, 2015 14:01
-
-
Save mattyohe/eb80b77ea668ebeeef45 to your computer and use it in GitHub Desktop.
HTML TextView sizing information
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
NSLayoutManager *layoutManager = [[self textView] layoutManager]; | |
NSTextContainer *container = [[self textView] textContainer]; | |
[layoutManager ensureLayoutForTextContainer:container]; | |
CGRect rect = [layoutManager usedRectForTextContainer:container]; | |
CGFloat height = CGRectGetHeight(rect); | |
UIEdgeInsets insets = [[self textView] textContainerInset]; | |
height += insets.top; | |
height += insets.bottom; | |
height = ceilf(height); | |
return CGSizeMake(320, height + 16); // 16 comes from the current top and bottom cell padding. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment