// // IHDevicePermisssionVCtr.swift // Inhealth // // Created by weclouds on 2019/12/23. // Copyright © 2019 weclouds. All rights reserved. // import UIKit import JXSegmentedView class IHDevicePermisssionVCtr: UIViewController ,UITableViewDelegate,UITableViewDataSource{ let manager = IHPermissionManager() var devices : [String]? lazy var tableView : UITableView = { let tableView = UITableView(frame: CGRect(x: 0, y: 0, width: KSCREENWIDTH, height: KSCREENHEIGHT - KNavBarHeight - 50 ), style: .plain) // tableView.separatorStyle = .none tableView.backgroundColor = .white tableView.delegate = self tableView.dataSource = self return tableView }() override func viewDidLoad() { super.viewDidLoad() view.addSubview(tableView) IHPermissionService.share.getUserPermissInfo({ (rootNode, devices) in self.devices = devices self.tableView.reloadData() }) { } } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return self.devices?.count ?? 0 } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 50 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { var cell = tableView.dequeueReusableCell(withIdentifier: "cell") if cell == nil { cell = UITableViewCell(style: .default, reuseIdentifier: "cell") } cell?.textLabel?.text = devices![indexPath.row] cell?.textLabel?.font = UIFont(name: PingFangSC_Medium, size: 12) cell?.textLabel?.textColor = UIColor(hexString: "#333333") cell?.selectionStyle = .none return cell! } } extension IHDevicePermisssionVCtr:JXSegmentedListContainerViewListDelegate{ func listView() -> UIView { return view } }