Browse Source

fix title

marinofaggiana 4 years ago
parent
commit
a15eb239b4
1 changed files with 7 additions and 3 deletions
  1. 7 3
      iOSClient/Media/NCMedia.swift

+ 7 - 3
iOSClient/Media/NCMedia.swift

@@ -138,9 +138,13 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
     
     func mediaCommandTitle() {
         mediaCommandView?.title.text = ""
-        if let cell = collectionView?.visibleCells.first as? NCGridMediaCell {
-            if cell.date != nil {
-                mediaCommandView?.title.text = CCUtility.getTitleSectionDate(cell.date)
+        
+        if let visibleCells = self.collectionView?.indexPathsForVisibleItems.sorted(by: { $0.row < $1.row }).compactMap({ self.collectionView?.cellForItem(at: $0) }) {
+        
+            if let cell = visibleCells.first as? NCGridMediaCell {
+                if cell.date != nil {
+                    mediaCommandView?.title.text = CCUtility.getTitleSectionDate(cell.date)
+                }
             }
         }
     }