Tag Archives: UI

Swift Tips #1: Extra padding problem on UITextView?

Sometimes when you integrate a design, you need things to be square, everything aligned: buttons, title, images, textView… But wait, what’s that extra padding on the UITextView? You may have tried to print the contentOffset or contentInset without success. That’s not it. However, all your problems can be solved in one line, and here it is: // magic line for a UITextView named textView textView.textContainer.lineFragmentPadding = 0 I wouldn’t call it exactly straight forward, so this is a memo for me and tip for you :)