marinofaggiana 6 years ago
parent
commit
af8ac78622

+ 8 - 6
iOSClient/Main/Section/NCSectionHeaderFooter.swift

@@ -177,12 +177,14 @@ class NCSectionMediaHeader: UICollectionReusableView {
         
         var title = ""
         
-        if sectionDatasource.sections.object(at: section) is String {
-            title = sectionDatasource.sections.object(at: section) as! String
-        }
-        if sectionDatasource.sections.object(at: section) is Date {
-            let titleDate = sectionDatasource.sections.object(at: section) as! Date
-            title = CCUtility.getTitleSectionDate(titleDate)
+        if sectionDatasource.sections.count > section {
+            if sectionDatasource.sections.object(at: section) is String {
+                title = sectionDatasource.sections.object(at: section) as! String
+            }
+            if sectionDatasource.sections.object(at: section) is Date {
+                let titleDate = sectionDatasource.sections.object(at: section) as! Date
+                title = CCUtility.getTitleSectionDate(titleDate)
+            }
         }
         
         labelSection.text = NSLocalizedString(title, comment: "")

+ 3 - 3
iOSClient/Media/NCMedia.swift

@@ -94,9 +94,6 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
         collectionView.emptyDataSetDelegate = self
         collectionView.emptyDataSetSource = self
         
-        // Title
-        self.navigationItem.title = NSLocalizedString("_media_", comment: "")
-
         // Notification
         NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: "changeTheming"), object: nil)
     }
@@ -123,6 +120,9 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
         autoUploadFileName = NCManageDatabase.sharedInstance.getAccountAutoUploadFileName()
         autoUploadDirectory = NCManageDatabase.sharedInstance.getAccountAutoUploadDirectory(appDelegate.activeUrl)
         
+        // Title
+        self.navigationItem.title = NSLocalizedString("_media_", comment: "")
+        
         // Fast Scrool
         configFastScroll()