3

How to make the initial scroll position be 0 on tvOS? I tried setContentOffset:CGPointZero and layoutIfNeeded, but it's not working.

[self.textView layoutIfNeeded];
self.textView.attributedText = myLongAttributedString;
[self.textView setContentOffset:CGPointZero animated:NO];
[self.textView layoutIfNeeded];

This is similar but different from UITextView initial scroll position is not 0 because my given solution for iOS isn't working for tvOS.

You can quickly reproduce the issue from tvOS example from https://github.com/laptobbe/TSMarkdownParser/tree/3.x (commit fba04cdd59ac55fc324a2100fcb800af2153f2af in case I fix the bug in the future) and switching the selected output to UITextView (with keyboard arrow if you're on simulator):
tvOS screenshot

Cœur
  • 37,241
  • 25
  • 195
  • 267

0 Answers0