Default UITextView has text insets, unlike the UILabel.

Default UITextView has text insets, unlike the UILabel.

How to remove the insets on UITextView like an UILabel?

UITextView

UITextView

On the storyboard, select the UITextView and remove the Scrolling Enabled.

@IBOutlet weak var textView: UITextView!
override func viewDidLoad() {
    super.viewDidLoad()
    textView.textContainer.lineFragmentPadding = 0
    textView.textContainerInset = .zero
}

removeInset.png

UITextView which is removed text insets will look like an UILabel.

Thanks for reviewing my post

Divjjot Singh ( 신승훈 )

Quote of the week

"People ask me what I do in the winter when there's no baseball. I'll tell you what I do. I stare out the window and wait for spring."

~ Rogers Hornsby