Explorar o código

Fix rounded corners not applying correctly

Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Milen Pivchev hai 1 ano
pai
achega
24e323c091
Modificáronse 2 ficheiros con 13 adicións e 4 borrados
  1. 8 0
      iOSClient/More/Cells/BaseNCMoreCell.swift
  2. 5 4
      iOSClient/More/NCMore.swift

+ 8 - 0
iOSClient/More/Cells/BaseNCMoreCell.swift

@@ -31,6 +31,14 @@ class BaseNCMoreCell: UITableViewCell {
 
         selectedBackgroundView = selectionColor
         backgroundColor = .secondarySystemGroupedBackground
+        applyCornerRadius()
+    }
+
+    func applyCornerRadius() {
         layer.cornerRadius = defaultCornerRadius
     }
+
+    func removeCornerRadius() {
+        layer.cornerRadius = 0
+    }
 }

+ 5 - 4
iOSClient/More/NCMore.swift

@@ -378,10 +378,12 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
 
             cell.separator.backgroundColor = .separator
             cell.separatorHeigth.constant = 0.4
-            
+
+            cell.removeCornerRadius()
             let rows = tableView.numberOfRows(inSection: indexPath.section)
             
             if indexPath.row == 0 {
+                cell.applyCornerRadius()
                 if indexPath.row == rows - 1 {
                     cell.separator.backgroundColor = .clear
                     cell.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner, .layerMaxXMaxYCorner, .layerMinXMaxYCorner]
@@ -389,12 +391,11 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
                     cell.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner]
                 }
             } else if indexPath.row == rows - 1 {
+                cell.applyCornerRadius()
                 cell.layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMinXMaxYCorner]
                 cell.separator.backgroundColor = .clear
-            } else {
-                cell.layer.cornerRadius = 0
             }
-            
+
             return cell
         }
     }