// // XinZengPinPaiViewController.swift // GeliBusinessPlatform // // Created by junye lu on 2020/4/26. // Copyright © 2020 junye lu. All rights reserved. // import UIKit import LGButton class XinZengPinPaiViewController: BaseViewController,UITableViewDataSource,UITableViewDelegate,TitleAndBtnCellDelegate { let titleArr = ["品牌名称","品牌图标","站点地址","品牌描述"] let holderArr = ["请输入品牌名称","0","请输入站点地址如:www.gelifood.com","0"] @IBOutlet weak var btnTitleLbl: UILabel! @IBOutlet weak var listView: UITableView! var navTitle:String? override func viewDidLoad() { super.viewDidLoad() navbar.title = navTitle if navTitle == "编辑品牌" { navbar.rightTitle = "删除" } self.view.addSubview(navbar) listView.snp.makeConstraints { (make) in make.top.equalTo(NavCGRect.height) make.left.right.equalTo(0) make.height.equalTo(323.5*glscale) } listView.separatorStyle = .none listView.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTF") listView.register(UINib(nibName: "TitleAndBtnCell", bundle: nil), forCellReuseIdentifier: "TitleAndBtn") listView.register(UINib(nibName: "TilteAndTextViewCell", bundle: nil), forCellReuseIdentifier: "TilteAndTextView") // Do any additional setup after loading the view. } func rightBtnClick() { } @IBAction func btnAction(_ sender: Any) { print("提交") } //MARK: - cell delegate func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { if indexPath.row == 3 { return 173.5*glscale } return 49*glscale } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return titleArr.count } func btnClick(content: String, cell: TitleAndBtnCell) { print(content) } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { switch indexPath.row { case 0,2: let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell cell.nameLbl.text = titleArr[indexPath.row] cell.textTF.placeholder = holderArr[indexPath.row] return cell case 1: let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell cell.nameLbl.text = titleArr[indexPath.row] cell.contentLbl.text = "上传图片" cell.delegate = self return cell default: let cell = tableView.dequeueReusableCell(withIdentifier: "TilteAndTextView") as! TilteAndTextViewCell cell.titleLbl.text = titleArr[indexPath.row] cell.holderLbl.text = "简述品牌体征。" return cell } } }