浏览代码

fix title

marinofaggiana 4 年之前
父节点
当前提交
a15eb239b4
共有 1 个文件被更改,包括 7 次插入3 次删除
  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)
+                }
             }
         }
     }