123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- //
- // OrderLogisticsInfoCell.swift
- // RainbowPlanet
- //
- // Created by Christopher on 2019/5/16.
- // Copyright © 2019 RainbowPlanet. All rights reserved.
- //
- import UIKit
- class OrderLogisticsInfoCell: UITableViewCell {
-
- var productMdl : ProductModel? {
- didSet {
-
- }
- }
-
- var isFirstCell: Bool = false {
- didSet {
- if isFirstCell == true {
- topLineView.isHidden = true
- }
- }
- }
-
- var isLastCell: Bool = false {
- didSet {
- if isLastCell == true {
- botLineView.isHidden = true
- }
- }
- }
-
- class func cellWith(tableView:UITableView,indexPath:IndexPath) -> OrderLogisticsInfoCell {
- let ID = "OrderLogisticsInfoCell"
- tableView.register(OrderLogisticsInfoCell.self, forCellReuseIdentifier: ID)
- let cell : OrderLogisticsInfoCell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! OrderLogisticsInfoCell
- 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(informationLabel)
- addSubview(iconImageView)
- addSubview(timeInfoLabel)
- addSubview(topLineView)
- addSubview(botLineView)
- }
-
- private func setupLayouts() {
- informationLabel.snp.makeConstraints { (make) in
- make.top.equalTo(13)
- make.right.equalTo(-28)
- make.left.equalTo(48)
- }
- iconImageView.snp.makeConstraints { (make) in
- make.left.equalToSuperview().offset(18)
- make.size.equalTo(12)
- make.centerY.equalTo(informationLabel)
- }
- timeInfoLabel.snp.makeConstraints { (make) in
- make.left.equalTo(informationLabel.snp_left)
- make.top.equalTo(informationLabel.snp_bottom).offset(8)
- make.bottom.equalTo(-12)
- make.height.equalTo(17)
- }
- topLineView.snp.makeConstraints { (make) in
- make.centerX.equalTo(iconImageView)
- make.top.equalToSuperview()
- make.bottom.equalTo(iconImageView.snp_top)
- make.width.equalTo(1)
- }
- botLineView.snp.makeConstraints { (make) in
- make.centerX.equalTo(iconImageView)
- make.top.equalTo(iconImageView.snp_bottom)
- make.bottom.equalToSuperview()
- make.width.equalTo(1)
- }
- }
-
-
- private lazy var iconImageView: UIImageView = {
- let iconImageView = UIImageView()
- iconImageView.image = kImage(name: "shopping_cart_trade_finish")
- return iconImageView
- }()
-
- private lazy var informationLabel: UILabel = {
- let informationLabel = UILabel()
- informationLabel.text = "时间轴展示也是一种比较常见的展现形式。一般用于展示以时间为主线的一连串事件"
- informationLabel.textColor = k333333Color
- informationLabel.font = kRegularFont13
- informationLabel.textAlignment = .left
- informationLabel.numberOfLines = 0
- return informationLabel
- }()
-
- private lazy var timeInfoLabel: UILabel = {
- let timeInfoLabel = UILabel()
- timeInfoLabel.text = "2019-02-29 17:20:08"
- timeInfoLabel.textColor = k666666Color
- timeInfoLabel.font = kRegularFont12
- timeInfoLabel.textAlignment = .left
- return timeInfoLabel
- }()
-
- private lazy var topLineView: UIView = {
- let topLineView = UIView()
- topLineView.backgroundColor = ke6e6e6Color
- return topLineView
- }()
-
- private lazy var botLineView: UIView = {
- let botLineView = UILabel()
- botLineView.backgroundColor = ke6e6e6Color
- return botLineView
- }()
-
- }
|