瀏覽代碼

Improved algorithm scroll

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 年之前
父節點
當前提交
10d47a73af
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift

+ 7 - 1
iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift

@@ -427,7 +427,13 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate, UIGestureRecogni
         let endY = visibleRect.origin.y + visibleRect.height + thumbnailViewHeight
 
         if currentPageY < startY {
-            if gotoY < 0 { gotoY = -UIApplication.shared.statusBarFrame.height }
+            if gotoY < 0 {
+                if navigationController?.isNavigationBarHidden ?? true {
+                    gotoY = -UIApplication.shared.statusBarFrame.height
+                } else {
+                    gotoY = (UIApplication.shared.keyWindow?.safeAreaInsets.top ?? 0) == 0 ? -UIApplication.shared.statusBarFrame.height : -((UIApplication.shared.keyWindow?.safeAreaInsets.top ?? 0) + UIApplication.shared.statusBarFrame.height)
+                }
+            }
             pdfThumbnailScrollView.setContentOffset(CGPoint(x: 0, y: gotoY), animated: true)
         } else if currentPageY > endY {
             if gotoY > pdfThumbnailView.frame.height - visibleRect.height { gotoY = pdfThumbnailView.frame.height - visibleRect.height}