6 Swift获取版本号和cell自定义方法传值

Swift版本为3.0

cell中获取版本号码及其他的处理方式

 cell?.textLabel?.text = "版本";

            cell?.imageView?.image = UIImage.init(named: "setting");
            cell?.accessoryType = UITableViewCellAccessoryType.none;
            cell?.selectionStyle = UITableViewCellSelectionStyle.none;

            cell?.detailTextLabel?.text = "version  \(Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String)"

cell的方法传参

首先在自定义cell里面先写出方法,注意不能是私有的,其次是在 cellForRow方法中调用

 func titleStr(title:String, name:String, bankNoStr:String, bankNameStr:String){
            self.titleLabel?.text = title;
            self.headImage?.image = UIImage.init(named: name)
            self.bankNoLabel?.text = bankNoStr
            self.bankLabel?.text = bankNameStr

    }

调用如下:

 cellone .titleStr(title: "全渠道", name: "third.jpeg", bankNoStr: "6227 0038 1192 2929 938", bankNameStr: "建设银行 都江堰支行");




你可能感兴趣的:(Swift笔记)