Created
April 22, 2018 09:47
-
-
Save ratulSharker/e64295fde9b5a8fe16764edc03ae2e08 to your computer and use it in GitHub Desktop.
This gist set's all the padding and inset to zero, so that UITextView is ready to wrap the content in it.
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
import UIKit | |
extension UITextView { | |
func wrapToContent() { | |
self.contentInset = UIEdgeInsets.zero | |
self.scrollIndicatorInsets = UIEdgeInsets.zero | |
self.contentOffset = CGPoint.zero | |
self.textContainerInset = UIEdgeInsets.zero | |
self.textContainer.lineFragmentPadding = 0 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment