UITextView starts at Bottom or Middle of the text

后端 未结 19 1654
谎友^
谎友^ 2020-12-04 13:09

I\'ll get right to it. I have a UItextView placed in my view that when needs to scroll to see all the text (when a lot of text is present in the textView) the t

19条回答
  •  感动是毒
    2020-12-04 13:18

    I had to implement two answers here to get my view working as I want:

    From Juan David Cruz Serrano:

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        textView.setContentOffset(CGPoint.zero, animated: false)
    }
    

    And from Murat Yasar:

    automaticallyAdjustsScrollViewInsets = false
    

    This gave a UITextView that loads with the scroll at the very top and where the insets are not changed once scrolling starts. Very strange that this is not the default behaviour.

提交回复
热议问题