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
  • 37,241
  • 25
  • 195
  • 267
Adam Diament
  • 4,290
  • 3
  • 34
  • 55

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
  • 37,241
  • 25
  • 195
  • 267
Adam Diament
  • 4,290
  • 3
  • 34
  • 55