UITextView Padding

If you align a UITextView with another element, particularly a UILabel, using Auto Layout you will notice the text in the UITextView is slightly indented. The UITextView is actually implemented inside an NSTextContainer which has some padding around it. To remove this (left/right) padding, set the following property of the UITextView to zero:

textView.textContainer.lineFragmentPadding = 0

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.