marinofaggiana 3 年之前
父節點
當前提交
c409891d60
共有 1 個文件被更改,包括 24 次插入4 次删除
  1. 24 4
      iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift

+ 24 - 4
iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift

@@ -74,9 +74,6 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate {
         
         self.title = NSLocalizedString("_upload_photos_videos_", comment: "")
         
-        view.backgroundColor = NCBrandColor.shared.systemGroupedBackground
-        tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground
-        
         self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(cancel))
         self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
         
@@ -88,7 +85,8 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate {
             })
         }
         
-        tableView.reloadData()
+        setColors(userInterfaceStyle: nil)
+        
         initializeForm()
         reloadForm()
     }
@@ -100,6 +98,28 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate {
         self.delegate?.dismissFormUploadAssets()
     }
     
+    override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
+        super.traitCollectionDidChange(previousTraitCollection)
+        
+        setColors(userInterfaceStyle: traitCollection.userInterfaceStyle)
+    }
+    
+    // MARK: - Colors
+    
+    func setColors(userInterfaceStyle: UIUserInterfaceStyle?) {
+        
+        if userInterfaceStyle == .dark {
+            // personalized
+        } else {
+            // personalized
+        }
+        
+        view.backgroundColor = NCBrandColor.shared.systemGroupedBackground
+        tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground
+        
+        tableView.reloadData()
+    }
+    
     //MARK: XLForm
     
     func initializeForm() {