Last active
November 1, 2017 09:23
-
-
Save christopherkarani/b7156d4ddee98150371446f192b49d85 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| func estimatedFrame(forText text: String) -> CGRect { | |
| // width is same as cell.texView width | |
| //height is an arbitrary larg value | |
| let size = CGSize(width: 200, height: 1000) | |
| let options = NSStringDrawingOptions.usesFontLeading.union(.usesLineFragmentOrigin) | |
| let attributes = [NSAttributedStringKey.font: UIFont.systemFont(ofSize: 16)] | |
| return NSString(string: text).boundingRect(with: size, options: options, attributes: attributes, context: nil) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment