Blank space at top of UITextView in iOS 10

Ali Sufyan picture Ali Sufyan · Sep 21, 2013 · Viewed 41.5k times · Source

I have UITextView with some text in it. Everything was fine with iOS 6 but now with iOS 7 it leaves the blank space on top and then place the text below the middle of the textview.enter image description here

I didn't set any contentOffSet. Please Help!

Answer

jrturton picture jrturton · Sep 21, 2013

A text view is a scroll view. View controllers will add a content offset automatically to scroll views, as it is assumed they will want to scroll up behind the nav bar and status bar.

To prevent this, set the following property on the view controller containing the text view:

self.automaticallyAdjustsScrollViewInsets = NO