浏览代码

only scroll down after keyboard appeared if last row was loaded

cyberta 4 年之前
父节点
当前提交
13091d39f7
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      deltachat-ios/Chat/ChatViewControllerNew.swift

+ 5 - 1
deltachat-ios/Chat/ChatViewControllerNew.swift

@@ -150,10 +150,14 @@ class ChatViewControllerNew: UITableViewController {
         if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue,
            tableView.inputAccessoryView?.frame.height ?? 0 < keyboardSize.height {
             originFrame = self.tableView.frame
+            let wasLastRowVisible = self.isLastRowVisible()
             if let originFrame = originFrame {
                 self.tableView.frame = CGRect(origin: originFrame.origin,
                                               size: CGSize(width: originFrame.width, height: originFrame.height - keyboardSize.height))
-                self.scrollToBottom(animated: false)
+
+                if wasLastRowVisible {
+                    self.scrollToBottom(animated: false)
+                }
             }
         }
     }