소스 검색

coding

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 3 년 전
부모
커밋
a5cc2581df
1개의 변경된 파일20개의 추가작업 그리고 4개의 파일을 삭제
  1. 20 4
      iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

+ 20 - 4
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -379,7 +379,11 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
             let (indexPath, sameSections) = dataSource.deleteMetadata(ocId: ocId)
             if let indexPath = indexPath {
                 if sameSections && (indexPath.section < collectionView.numberOfSections && indexPath.row < collectionView.numberOfItems(inSection: indexPath.section)) {
-                    collectionView?.deleteItems(at: [indexPath])
+                    collectionView?.performBatchUpdates({
+                        collectionView?.deleteItems(at: [indexPath])
+                    }, completion: { _ in
+                        self.collectionView?.reloadData()
+                    })
                 } else {
                     self.collectionView?.reloadData()
                 }
@@ -401,7 +405,11 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         let (indexPath, sameSections) = dataSource.deleteMetadata(ocId: ocId)
         if let indexPath = indexPath {
             if sameSections && (indexPath.section < collectionView.numberOfSections && indexPath.row < collectionView.numberOfItems(inSection: indexPath.section)) {
-                collectionView?.deleteItems(at: [indexPath])
+                collectionView?.performBatchUpdates({
+                    collectionView?.deleteItems(at: [indexPath])
+                }, completion: { _ in
+                    self.collectionView?.reloadData()
+                })
             } else {
                 self.collectionView?.reloadData()
             }
@@ -533,7 +541,11 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         let (indexPath, sameSections) = dataSource.reloadMetadata(ocId: metadata.ocId, ocIdTemp: ocIdTemp)
         if let indexPath = indexPath {
             if sameSections && (indexPath.section < collectionView.numberOfSections && indexPath.row < collectionView.numberOfItems(inSection: indexPath.section)) {
-                collectionView?.reloadItems(at: [indexPath])
+                collectionView?.performBatchUpdates({
+                    collectionView?.reloadItems(at: [indexPath])
+                }, completion: { _ in
+                    self.collectionView?.reloadData()
+                })
             } else {
                 self.collectionView?.reloadData()
             }
@@ -555,7 +567,11 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         let (indexPath, sameSections) = dataSource.deleteMetadata(ocId: ocId)
         if let indexPath = indexPath {
             if sameSections && (indexPath.section < collectionView.numberOfSections && indexPath.row < collectionView.numberOfItems(inSection: indexPath.section)) {
-                collectionView?.deleteItems(at: [indexPath])
+                collectionView?.performBatchUpdates({
+                    collectionView?.deleteItems(at: [indexPath])
+                }, completion: { _ in
+                    self.collectionView?.reloadData()
+                })
             } else {
                 self.collectionView?.reloadData()
             }