2

It appears that like in native Xcode, in Xamarin studio for ioS if your first sub-view in a view hierarchy is a UITextView, then adding a top-layout constraint to this view will cause a large block of empty space to appear at the top of the scroll view.

This is similar to the Xcode version of the question here

iOS 7 UITextView vertical alignment

Cœur
  • 34,719
  • 24
  • 185
  • 251
Adam Diament
  • 3,620
  • 1
  • 30
  • 50

1 Answers1

2

I solved this programmatically by adapting

Tanguy-G's answer for native Objective-C by setting AutomaticallyAdjustsScrollViewInsets to false in the constructor of my view controller.

    public MyLovelyViewController (IntPtr handle) : base (handle)
    {
        this.AutomaticallyAdjustsScrollViewInsets = false;
    }

EDIT: If you are setting any other aspects of the text view in question programmatically, make sure to call

this.AutomaticallyAdjustsScrollViewInsets = false;

after any other adjustments, otherwise the space will reappear, e.g:

    confirmSummary.Editable = false;
    confirmSummary.Selectable = false;
    this.AutomaticallyAdjustsScrollViewInsets = false;

(I did this in the override of ViewDidLoad)

Cœur
  • 34,719
  • 24
  • 185
  • 251
Adam Diament
  • 3,620
  • 1
  • 30
  • 50