marinofaggiana 5 жил өмнө
parent
commit
1a4219d3af

+ 9 - 4
iOSClient/Main/NCDetailViewController.swift

@@ -260,7 +260,9 @@ class NCDetailViewController: UIViewController {
             // PDF
             if metadata.contentType == "application/pdf" {
                 if #available(iOS 11.0, *) {
-                    let viewerPDF = NCViewerPDF.init(frame: backgroundView.frame)
+                    
+                    let frame = CGRect(x: 0, y: 0, width: self.backgroundView.frame.width, height: self.backgroundView.frame.height)
+                    let viewerPDF = NCViewerPDF.init(frame: frame)
                     
                     let filePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
                     if CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) == false {
@@ -294,7 +296,8 @@ class NCDetailViewController: UIViewController {
                             
                             if errorCode == 0 && account == self.appDelegate.activeAccount && url != nil {
                                 
-                                let nextcloudText = NCViewerNextcloudText.init(frame: self.backgroundView.frame, configuration: WKWebViewConfiguration())
+                                let frame = CGRect(x: 0, y: 0, width: self.backgroundView.frame.width, height: self.backgroundView.frame.height)
+                                let nextcloudText = NCViewerNextcloudText.init(frame: frame, configuration: WKWebViewConfiguration())
                                 nextcloudText.viewerAt(url!, metadata: metadata, editor: editor, view: self.backgroundView, viewController: self)
                                 if editor == k_editor_text && self.splitViewController!.isCollapsed {
                                     self.navigationController?.navigationItem.hidesBackButton = true
@@ -313,7 +316,8 @@ class NCDetailViewController: UIViewController {
                         
                     } else {
                         
-                        let nextcloudText = NCViewerNextcloudText.init(frame: backgroundView.frame, configuration: WKWebViewConfiguration())
+                        let frame = CGRect(x: 0, y: 0, width: self.backgroundView.frame.width, height: self.backgroundView.frame.height)
+                        let nextcloudText = NCViewerNextcloudText.init(frame: frame, configuration: WKWebViewConfiguration())
                         nextcloudText.viewerAt(metadata.url, metadata: metadata, editor: editor, view: backgroundView, viewController: self)
                         if editor == k_editor_text && self.splitViewController!.isCollapsed {
                             self.navigationController?.navigationItem.hidesBackButton = true
@@ -335,7 +339,8 @@ class NCDetailViewController: UIViewController {
                         
                         if errorCode == 0 && account == self.appDelegate.activeAccount && url != nil {
                             
-                            let richDocument = NCViewerRichdocument.init(frame: self.backgroundView.frame, configuration: WKWebViewConfiguration())
+                            let frame = CGRect(x: 0, y: 0, width: self.backgroundView.frame.width, height: self.backgroundView.frame.height)
+                            let richDocument = NCViewerRichdocument.init(frame: frame, configuration: WKWebViewConfiguration())
                             richDocument.viewRichDocumentAt(url!, metadata: metadata, view: self.backgroundView, viewController: self)
                             if self.splitViewController != nil && self.splitViewController!.isCollapsed {
                                 self.navigationController?.navigationItem.hidesBackButton = true

+ 2 - 2
iOSClient/Viewer/NCViewerPDF.swift

@@ -37,8 +37,8 @@ import PDFKit
     }
     
     override init(frame: CGRect) {
-        let height = frame.height - frame.origin.y - thumbnailViewHeight
-        super.init(frame: CGRect(x: 0, y: 0, width: frame.width, height: height))
+        let height = frame.height - thumbnailViewHeight
+        super.init(frame: CGRect(x: frame.origin.x, y: frame.origin.y, width: frame.width, height: height))
         NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: k_notificationCenter_changeTheming), object: nil)
     }