OrderLogisticsInfoCell.swift 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. //
  2. // OrderLogisticsInfoCell.swift
  3. // RainbowPlanet
  4. //
  5. // Created by Christopher on 2019/5/16.
  6. // Copyright © 2019 RainbowPlanet. All rights reserved.
  7. //
  8. import UIKit
  9. class OrderLogisticsInfoCell: UITableViewCell {
  10. var productMdl : ProductModel? {
  11. didSet {
  12. }
  13. }
  14. var isFirstCell: Bool = false {
  15. didSet {
  16. if isFirstCell == true {
  17. topLineView.isHidden = true
  18. }
  19. }
  20. }
  21. var isLastCell: Bool = false {
  22. didSet {
  23. if isLastCell == true {
  24. botLineView.isHidden = true
  25. }
  26. }
  27. }
  28. class func cellWith(tableView:UITableView,indexPath:IndexPath) -> OrderLogisticsInfoCell {
  29. let ID = "OrderLogisticsInfoCell"
  30. tableView.register(OrderLogisticsInfoCell.self, forCellReuseIdentifier: ID)
  31. let cell : OrderLogisticsInfoCell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! OrderLogisticsInfoCell
  32. cell.indexPath = indexPath
  33. return cell
  34. }
  35. override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  36. super.init(style: style, reuseIdentifier: reuseIdentifier)
  37. setupViews()
  38. setupLayouts()
  39. }
  40. required init?(coder aDecoder: NSCoder) {
  41. fatalError("init(coder:) has not been implemented")
  42. }
  43. var indexPath: IndexPath? {
  44. didSet {
  45. }
  46. }
  47. //MRAK: - 设置View
  48. private func setupViews() {
  49. self.selectionStyle = .none
  50. addSubview(informationLabel)
  51. addSubview(iconImageView)
  52. addSubview(timeInfoLabel)
  53. addSubview(topLineView)
  54. addSubview(botLineView)
  55. }
  56. private func setupLayouts() {
  57. informationLabel.snp.makeConstraints { (make) in
  58. make.top.equalTo(13)
  59. make.right.equalTo(-28)
  60. make.left.equalTo(48)
  61. }
  62. iconImageView.snp.makeConstraints { (make) in
  63. make.left.equalToSuperview().offset(18)
  64. make.size.equalTo(12)
  65. make.centerY.equalTo(informationLabel)
  66. }
  67. timeInfoLabel.snp.makeConstraints { (make) in
  68. make.left.equalTo(informationLabel.snp_left)
  69. make.top.equalTo(informationLabel.snp_bottom).offset(8)
  70. make.bottom.equalTo(-12)
  71. make.height.equalTo(17)
  72. }
  73. topLineView.snp.makeConstraints { (make) in
  74. make.centerX.equalTo(iconImageView)
  75. make.top.equalToSuperview()
  76. make.bottom.equalTo(iconImageView.snp_top)
  77. make.width.equalTo(1)
  78. }
  79. botLineView.snp.makeConstraints { (make) in
  80. make.centerX.equalTo(iconImageView)
  81. make.top.equalTo(iconImageView.snp_bottom)
  82. make.bottom.equalToSuperview()
  83. make.width.equalTo(1)
  84. }
  85. }
  86. private lazy var iconImageView: UIImageView = {
  87. let iconImageView = UIImageView()
  88. iconImageView.image = kImage(name: "shopping_cart_trade_finish")
  89. return iconImageView
  90. }()
  91. private lazy var informationLabel: UILabel = {
  92. let informationLabel = UILabel()
  93. informationLabel.text = "时间轴展示也是一种比较常见的展现形式。一般用于展示以时间为主线的一连串事件"
  94. informationLabel.textColor = k333333Color
  95. informationLabel.font = kRegularFont13
  96. informationLabel.textAlignment = .left
  97. informationLabel.numberOfLines = 0
  98. return informationLabel
  99. }()
  100. private lazy var timeInfoLabel: UILabel = {
  101. let timeInfoLabel = UILabel()
  102. timeInfoLabel.text = "2019-02-29 17:20:08"
  103. timeInfoLabel.textColor = k666666Color
  104. timeInfoLabel.font = kRegularFont12
  105. timeInfoLabel.textAlignment = .left
  106. return timeInfoLabel
  107. }()
  108. private lazy var topLineView: UIView = {
  109. let topLineView = UIView()
  110. topLineView.backgroundColor = ke6e6e6Color
  111. return topLineView
  112. }()
  113. private lazy var botLineView: UIView = {
  114. let botLineView = UILabel()
  115. botLineView.backgroundColor = ke6e6e6Color
  116. return botLineView
  117. }()
  118. }