Browse Source

only scroll down after keyboard appeared if last row was loaded

cyberta 4 năm trước cách đây
mục cha
commit
13091d39f7
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  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)
+                }
             }
         }
     }