iOS -- UITextView disable scrolling but enable touches

Swift 3, Swift 4:

let textView = UITextView()
textView.isScrollEnabled = false

If I set scrollEnabled to NO and have an empty implementation of scrollRectToVisible:animated:, it appears to disable scrolling.


UITextView is a subclass of UIScrollView, so you can prevent the view from scrolling by setting the property scrollEnabled to NO.


Just set the UITextView’s content size to be less than or equal to its bounds, this will prevent scrolling and still accept touch events.