Browse Source

Improved more

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 years ago
parent
commit
15fd497329
2 changed files with 30 additions and 16 deletions
  1. 12 0
      iOSClient/More/NCMore.storyboard
  2. 18 16
      iOSClient/More/NCMore.swift

+ 12 - 0
iOSClient/More/NCMore.storyboard

@@ -46,11 +46,21 @@
                                                     <nil key="textColor"/>
                                                     <nil key="highlightedColor"/>
                                                 </label>
+                                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="MPj-WT-PTu">
+                                                    <rect key="frame" x="53" y="49" width="391" height="1"/>
+                                                    <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="1" id="9Ku-ZW-4rh"/>
+                                                    </constraints>
+                                                </view>
                                             </subviews>
                                             <constraints>
+                                                <constraint firstAttribute="trailing" secondItem="MPj-WT-PTu" secondAttribute="trailing" constant="-30" id="3wF-o4-3ul"/>
+                                                <constraint firstAttribute="bottom" secondItem="MPj-WT-PTu" secondAttribute="bottom" id="6tD-Wa-D3O"/>
                                                 <constraint firstItem="E8e-56-e81" firstAttribute="centerY" secondItem="1FG-Yi-cbC" secondAttribute="centerY" id="7hX-BA-LAg"/>
                                                 <constraint firstItem="E8e-56-e81" firstAttribute="leading" secondItem="ybA-XY-jKA" secondAttribute="trailing" constant="20" id="KY9-RM-FdA"/>
                                                 <constraint firstAttribute="leadingMargin" secondItem="ybA-XY-jKA" secondAttribute="leading" id="VBx-FZ-Ld2"/>
+                                                <constraint firstItem="MPj-WT-PTu" firstAttribute="leading" secondItem="1FG-Yi-cbC" secondAttribute="leading" constant="53" id="VvQ-pe-sUS"/>
                                                 <constraint firstItem="ybA-XY-jKA" firstAttribute="centerY" secondItem="1FG-Yi-cbC" secondAttribute="centerY" id="ZLU-lg-ptd"/>
                                                 <constraint firstAttribute="trailingMargin" secondItem="E8e-56-e81" secondAttribute="trailing" id="mcH-pH-ru3"/>
                                             </constraints>
@@ -58,6 +68,8 @@
                                         <connections>
                                             <outlet property="imageIcon" destination="ybA-XY-jKA" id="YlP-ic-UyR"/>
                                             <outlet property="labelText" destination="E8e-56-e81" id="LB7-UK-1fa"/>
+                                            <outlet property="separator" destination="MPj-WT-PTu" id="V1s-2h-Ybb"/>
+                                            <outlet property="separatorHeigth" destination="9Ku-ZW-4rh" id="wdU-nc-Llh"/>
                                         </connections>
                                     </tableViewCell>
                                 </prototypes>

+ 18 - 16
iOSClient/More/NCMore.swift

@@ -53,7 +53,6 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
         tableView.delegate = self
         tableView.dataSource = self
         tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground
-        tableView.separatorColor = NCBrandColor.shared.separator
         tableView.register(UINib(nibName: "NCMoreUserCell", bundle: nil), forCellReuseIdentifier: "userCell")
 
         // create tap gesture recognizer
@@ -302,20 +301,6 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
         return cont
     }
     
-    func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
-    
-        cell.layer.cornerRadius = 0
-        let rows = tableView.numberOfRows(inSection: indexPath.section)
-        
-        if indexPath.row == 0 {
-            cell.layer.cornerRadius = 20
-            cell.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner]
-        } else if indexPath.row == rows - 1 {
-            cell.layer.cornerRadius = 20
-            cell.layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMinXMaxYCorner]
-        }
-    }
-
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
 
         var item = NKExternalSite()
@@ -390,6 +375,21 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
             cell.backgroundColor = NCBrandColor.shared.secondarySystemGroupedBackground
             cell.accessoryType = UITableViewCell.AccessoryType.disclosureIndicator
 
+            cell.separator.backgroundColor = NCBrandColor.shared.separator
+            cell.separatorHeigth.constant = 0.4
+            
+            cell.layer.cornerRadius = 0
+            let rows = tableView.numberOfRows(inSection: indexPath.section)
+            
+            if indexPath.row == 0 {
+                cell.layer.cornerRadius = 20
+                cell.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner]
+            } else if indexPath.row == rows - 1 {
+                cell.layer.cornerRadius = 20
+                cell.layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMinXMaxYCorner]
+                cell.separator.backgroundColor = .clear
+            }
+            
             return cell
         }
     }
@@ -473,7 +473,9 @@ class CCCellMore: UITableViewCell {
 
     @IBOutlet weak var labelText: UILabel!
     @IBOutlet weak var imageIcon: UIImageView!
-    
+    @IBOutlet weak var separator: UIView!
+    @IBOutlet weak var separatorHeigth: NSLayoutConstraint!
+
     override var frame: CGRect {
         get {
             return super.frame