RedLineTom
RedLineTom

Reputation: 35

Setting textView to start at top (Swift)

I'm looking to have my textView in Xcode to start at the top because it is currently starting a little under the top.

 //This is the code I'm using currently to try and have it start at the top

 self.productDescription .scrollRangeToVisible(NSMakeRange(0, 0))

However this is not working. Anyone have any ideas what the problem could be?

Upvotes: 1

Views: 1300

Answers (1)

Wesley
Wesley

Reputation: 2200

The UITextView element has contentInsets by default. You can try changing the values of the textView.contentInset like so:

textView.contentInset = UIEdgeInsetsMake(-4,-8,0,0);

Upvotes: 3

Related Questions