Sfoglia il codice sorgente

【2025】【Bug】页面编辑跳转问题

dinglingui 2 mesi fa
parent
commit
4051f2b638

+ 8 - 4
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailBaseViewController.swift

@@ -151,11 +151,15 @@ class KMNThumbnailBaseViewController: KMNBaseViewController,NSCollectionViewDele
                 indexpaths.insert(indexpath)
             }
             
-            if indexpaths.count > 0 {
-                self.collectionView.scrollToItems(at: indexpaths, scrollPosition: .centeredVertically)
+            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {//页面跳转进入时未直接滚动和选中
+                if indexpaths.count > 0 {
+                    self.collectionView.scrollToItems(at: indexpaths, scrollPosition: .top)
+                }
+
+                self.isChangeIndexPaths = true
+                self.collectionView.selectionIndexPaths = indexpaths
+                self.isChangeIndexPaths = false
             }
-            
-            self.collectionView.selectionIndexPaths = indexpaths
         }
     }