소스 검색

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() {