Преглед изворни кода

take safeAreaInsets into account for chat table view top alignment

cyberta пре 3 година
родитељ
комит
ec40041af3
1 измењених фајлова са 5 додато и 1 уклоњено
  1. 5 1
      deltachat-ios/Chat/ChatViewController.swift

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

@@ -291,7 +291,11 @@ class ChatViewController: UITableViewController {
     }
 
     private func getTopInsetHeight() -> CGFloat {
-        return UIApplication.shared.statusBarFrame.height + (navigationController?.navigationBar.bounds.height ?? 0)
+        let navigationBarHeight = (navigationController?.navigationBar.bounds.height ?? 0)
+        if let root = UIApplication.shared.keyWindow?.rootViewController {
+            return navigationBarHeight + root.view.safeAreaInsets.top
+        }
+        return UIApplication.shared.statusBarFrame.height + navigationBarHeight
     }
 
     private func startTimer() {