0

I have a UIViewController embedded in a UINavigationController. The UIViewController contains a UITextView (which takes up the entire screen except for the nav bar and menu area.

For some reason there is an area of whitespace at the top of the textview (the space is there both in Xcode and when the app runs).

Does anyone know why this is happening?

enter image description here

RobertJoseph
  • 7,968
  • 12
  • 68
  • 113

2 Answers2

1

This is because when you are having a navigation bar & then dragging UITextView inside the viewController, UITextView makes sure you have that much whitespace at the top of it for visibility of the navigation bar.

If you remove the navigation bar then you will notice the whitespace gets removed. Its Xcode's way of ensuring that once you include a navigation bar in a ViewController, you will have that space reserved for the Nav bar, no matter if you include the UITextView including the navigation bar above it in storyboard.

This is not a documented answer, I have encountered this same problem & this is the only logical explanation there can be.

cyberlobe
  • 1,783
  • 1
  • 18
  • 30
Saheb Roy
  • 5,899
  • 3
  • 23
  • 35
1

It seems to be issue with xcode. Try to add UIView between viewcontroller view and UITextview hope it will help you.enter image description here

Kathiravan G
  • 487
  • 4
  • 11