// // PaymentCodeViewControllers.swift // Lookfit // // Created by ecell on 2022/8/25. // Copyright © 2022 Sheldon. All rights reserved. // import UIKit import AVFoundation class PaymentCodeViewControllers: ViewController { var payArr:[String] = [MultiLanguageKey.aliPayCode.localized, MultiLanguageKey.weChatPayCode.localized, MultiLanguageKey.payPalCode.localized] var imgArr:[String] = ["aliPayCode_cell_icon", "icon_wechat", "paypalCode_cell_icon", ] var tableView:UITableView? override func loadView() { super.loadView() } override func makeUI() { super.makeUI() } override func viewDidLoad() { super.viewDidLoad() let label:UILabel = UILabel(frame: CGRect(x: 25, y: 15, width: view.frame.size.width, height: 18)) label.textColor = kHexColor(0x2A2A2A) label.font = SystemSemiboldFont(16) label.text = "收款".localized self.view.addSubview(label); //创建表视图 self.tableView = UITableView(frame: CGRect(x: 0, y: 48, width: Int(view.frame.size.width), height: 50*payArr.count), style:UITableView.Style.plain) self.tableView!.delegate = self self.tableView!.dataSource = self self.tableView!.rowHeight = 50 self.tableView?.isScrollEnabled = false self.tableView!.register(UITableViewCell.self, forCellReuseIdentifier: "SwiftCell") //设置允许单元格多选 self.view.addSubview(self.tableView!) } } extension PaymentCodeViewControllers: UITableViewDelegate { // 选中 func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let viewModel = UpdataQRCodeImgViewModels() viewModel.titleName = self.payArr[indexPath.row] viewModel.payType = indexPath.row + 1 viewModel.viewType = "QB" self.navigator.show(segue: .upDataQRCodeImg(ViewModel: viewModel), sender: self) } } extension PaymentCodeViewControllers: UITableViewDataSource { func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return payArr.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let identify:String = "SwiftCell" let cell = tableView.dequeueReusableCell(withIdentifier: identify, for: indexPath) cell.selectionStyle = UITableViewCell.SelectionStyle.none cell.textLabel?.text = self.payArr[indexPath.row] cell.imageView?.image = UIImage(named: self.imgArr[indexPath.row]) cell.accessoryType = UITableViewCell.AccessoryType.disclosureIndicator return cell } }