瀏覽代碼

RemoteNetworkDataSource: Add heightForRow to return a higher rowheight for the wificell

Carola Nitz 6 年之前
父節點
當前提交
5f2eef3f43
共有 1 個文件被更改,包括 13 次插入0 次删除
  1. 13 0
      Sources/LocalNetworkConnectivity/RemoteNetworkDataSource.swift

+ 13 - 0
Sources/LocalNetworkConnectivity/RemoteNetworkDataSource.swift

@@ -111,4 +111,17 @@ class RemoteNetworkDataSource: NSObject, UITableViewDataSource, UITableViewDeleg
             return nil
         }
     }
+
+    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+        guard let cellType = RemoteNetworkCellType(rawValue: indexPath.row) else {
+            assertionFailure("We're having more rows than types of cells that should never happen")
+            return UITableView.automaticDimension
+        }
+        switch cellType {
+        case .cloud, .streaming, .download:
+            return UITableView.automaticDimension
+        case .wifi:
+            return 60
+        }
+    }
 }