123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- //
- // CommonPayCell.swift
- // RainbowPlanet
- //
- // Created by Christopher on 2019/5/10.
- // Copyright © 2019 RainbowPlanet. All rights reserved.
- //
- import UIKit
- class CommonPayCell: UITableViewCell {
-
- var iconImageView: UIImageView = {
- let iconImageView = UIImageView()
- return iconImageView
- }()
-
- var titleLabel: UILabel = {
- let titleLabel = UILabel()
- titleLabel.textColor = k333333Color
- titleLabel.font = kRegularFont14
- titleLabel.textAlignment = .left
- return titleLabel
- }()
-
- var statusImageView: UIImageView = {
- let statusImageView = UIImageView()
- return statusImageView
- }()
-
- class func cellWith(tableView:UITableView,indexPath:IndexPath) -> CommonPayCell {
- let ID = "CommonPayCell"
- tableView.register(CommonPayCell.self, forCellReuseIdentifier: ID)
- let cell : CommonPayCell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! CommonPayCell
- cell.indexPath = indexPath
- return cell
- }
-
- override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
- super.init(style: style, reuseIdentifier: reuseIdentifier)
- setupViews()
- setupLayouts()
- }
-
- required init?(coder aDecoder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
-
- var indexPath: IndexPath? {
- didSet {
-
- }
- }
-
- //MRAK: - 设置View
- private func setupViews() {
- self.selectionStyle = .none
-
- addSubview(iconImageView)
- addSubview(titleLabel)
- addSubview(statusImageView)
- }
-
- private func setupLayouts() {
- iconImageView.snp.makeConstraints { (make) in
- make.left.equalToSuperview().offset(20)
- make.width.height.equalTo(20)
- make.centerY.equalToSuperview()
- }
- titleLabel.snp.makeConstraints { (make) in
- make.left.equalTo(iconImageView.snp_right).offset(10)
- make.height.equalTo(20)
- make.centerY.equalToSuperview()
- }
- statusImageView.snp.makeConstraints { (make) in
- make.right.equalToSuperview().offset(-20)
- make.width.height.equalTo(18)
- make.centerY.equalToSuperview()
- }
-
- }
-
- }
|