Bläddra i källkod

dev form conflict

marinofaggiana 5 år sedan
förälder
incheckning
6e74e62730

+ 59 - 1
iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift

@@ -39,5 +39,63 @@ class NCCreateFormUploadConflict: UIViewController {
     @IBOutlet weak var buttonCancel: UIButton!
     @IBOutlet weak var buttonContinue: UIButton!
     
-    var metadatas: [tableMetadata]?
+    private let appDelegate = UIApplication.shared.delegate as! AppDelegate
+    private var metadatas: [tableMetadata]
+    
+    // This is also necessary when extending the superclass.
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented") // or see Roman Sausarnes's answer
+    }
+    
+    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
+        self.metadatas = [tableMetadata]()
+        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
+    }
+    
+    convenience init(metadatas: [tableMetadata]) {
+        self.init(nibName:nil, bundle:nil)
+        self.metadatas = metadatas
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        
+        tableView.dataSource = self
+        tableView.delegate = self
+        
+        tableView.register(UINib.init(nibName: "NCCreateFormUploadConflictCell", bundle: nil), forCellReuseIdentifier: "Cell")
+    }
+}
+
+
+// MARK: - UITableViewDelegate
+
+extension NCCreateFormUploadConflict: UITableViewDelegate {
+    
+    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+        return 60
+    }
+}
+
+// MARK: - UITableViewDataSource
+
+extension NCCreateFormUploadConflict: UITableViewDataSource {
+    
+    func numberOfSections(in tableView: UITableView) -> Int {
+        return 1
+    }
+    
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return metadatas.count
+    }
+    
+    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        
+        if let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as? NCCreateFormUploadConflictCell {
+            
+            return cell
+        }
+        
+        return UITableViewCell()
+    }
 }

+ 1 - 1
iOSClient/Main/Create cloud/NCCreateFormUploadConflictCell.xib

@@ -9,7 +9,7 @@
     <objects>
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
-        <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" rowHeight="118" id="eGO-5i-ez1" customClass="NCCreateFormUploadConflictCell" customModule="Nextcloud" customModuleProvider="target">
+        <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" rowHeight="118" id="eGO-5i-ez1" customClass="NCCreateFormUploadConflictCell" customModule="Nextcloud" customModuleProvider="target">
             <rect key="frame" x="0.0" y="0.0" width="589" height="117"/>
             <autoresizingMask key="autoresizingMask"/>
             <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="eGO-5i-ez1" id="y6Q-vz-Xda">