UITextView text content doesn't start from the top
Reference: https://stackoverflow.com/questions/26835944/uitextview-text-content-doesnt-start-from-the-top
I am using this method:
override func viewWillAppear(_ animated: Bool) { yourTextView.isScrollEnabled = false yourTextView.text = "....."
} override func viewDidAppear(_ animated: Bool) { yourTextView.isScrollEnabled = true }
Principle: When a large amount of text is inserted, it will cause the page to scroll down, so in the viewWillAppear stage, first lock the scroll of the page, and then import the text so that it does not scroll down automatically. Then in the viewDidAppear stage, allow scrolling again