title: How to solve "auto-scroll" in UITextView?
body: <p>I have written a function<code>scrollToVisible()</code> to scroll text in <code>UItextview</code> because some part of text is covered by the keyboard, or the cursor isn't in visible. But <code>UItextview</code> can scroll the text automatically when the cursor is not in the whole view but not visible, it can still be covered by keyboard by automatically scroll.The UItextview's auto scroll can interrupt my <code>scrollToVisible()</code>.
  Thus, can I ban the UItexview to scroll automatically? Or another way to solve "keyboard cover" problem?</p>
  
  <p>My scrollToVisible() function</p>
  
  <pre><code>func scrollToVisible()
  {
      let cursortop = self.EditArea.convert(self.EditArea.caretRect(for: (self.EditArea.selectedTextRange?.start)!).origin, to: self.view)
      var cursorbottom = cursortop
      cursorbottom.y += self.EditArea.caretRect(for: (self.EditArea.selectedTextRange?.start)!).height
      let bottom = UIScreen.main.bounds.size.height - self.EditArea.textContainerInset.bottom
      var contentOffset = self.EditArea.contentOffset
      if cursortop.y &lt;= 85
      {
          contentOffset.y = contentOffset.y - 85 + cursortop.y
          self.EditArea.setContentOffset(contentOffset, animated: true)
      }
      else if cursorbottom.y &gt;= bottom
      {
          contentOffset.y = contentOffset.y - bottom + cursorbottom.y
          self.EditArea.setContentOffset(contentOffset, animated: true)
      }
  }
  </code></pre>
  
  <p>PS:this EditArea is the textview</p>