Răsfoiți Sursa

fix scrollToItem in Trash

Marino Faggiana 6 ani în urmă
părinte
comite
7ad8f64d0c
1 a modificat fișierele cu 6 adăugiri și 4 ștergeri
  1. 6 4
      iOSClient/Trash/NCTrash.swift

+ 6 - 4
iOSClient/Trash/NCTrash.swift

@@ -109,10 +109,12 @@ class NCTrash: UIViewController ,UICollectionViewDataSource, UICollectionViewDel
         super.viewDidAppear(animated)
         
         if scrollToFileID != "" {
-            for item in 0...datasource.count-1 {
-                if datasource[item].fileID.contains(scrollToFileID) {
-                    scrollToIndexPath = IndexPath(item: item, section: 0)
-                    collectionView.scrollToItem(at: scrollToIndexPath!, at: .top, animated: true)
+            DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
+                for item in 0...self.datasource.count-1 {
+                    if self.datasource[item].fileID.contains(self.scrollToFileID) {
+                        self.scrollToIndexPath = IndexPath(item: item, section: 0)
+                        self.collectionView.scrollToItem(at: self.scrollToIndexPath!, at: .top, animated: true)
+                    }
                 }
             }
         }