Pārlūkot izejas kodu

adapt inputbar height on entered new lines

cyberta 2 gadi atpakaļ
vecāks
revīzija
155bfe67ac
1 mainītis faili ar 8 papildinājumiem un 0 dzēšanām
  1. 8 0
      deltachat-ios/Chat/ChatViewController2.swift

+ 8 - 0
deltachat-ios/Chat/ChatViewController2.swift

@@ -43,6 +43,7 @@ class ChatViewController2: UIViewController {
         textView.font = UIFont.preferredFont(forTextStyle: .body)
         textView.backgroundColor = DcColors.inputFieldColor
         textView.isEditable = true
+        textView.delegate = self
         return textView
     }()
 
@@ -225,3 +226,10 @@ extension ChatViewController2: UITableViewDataSource {
         return UITableViewCell()
     }
 }
+
+// MARK: - UITextViewDelegate
+extension ChatViewController2: UITextViewDelegate {
+    func textViewDidChange(_ textView: UITextView) {
+        self.bottomInset = self.getInputTextHeight() + (self.keyboardManager?.keyboardHeight ?? 0)
+    }
+}