Blame view

App/createNew/CellChonMucChup.swift 1.67 KB
d774f0637   Trịnh Văn Quân   fisrt comit
1
2
  import Foundation
  import UIKit
1341bf603   Trịnh Văn Quân   version 1.1
3
  import GeneralUtils
d774f0637   Trịnh Văn Quân   fisrt comit
4
5
6
  
  class CellChonMucChup: BaseTableViewCellUI {
      var tvTitle: UILabel!
1341bf603   Trịnh Văn Quân   version 1.1
7
      var mucChup: ShootItem!
d774f0637   Trịnh Văn Quân   fisrt comit
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  
      static func registerClass(tableView: UITableView, forCellReuseIdentifier: String) {
          tableView.register(CellChonMucChup.self, forCellReuseIdentifier: forCellReuseIdentifier)
      }
  
      override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
          super.init(style: style, reuseIdentifier: reuseIdentifier)
          initView()
      }
  
      required init?(coder aDecoder: NSCoder) {
          super.init(coder: aDecoder)
          initView()
      }
  
      private func initView() {
          tvTitle = UILabel()
          tvTitle.translatesAutoresizingMaskIntoConstraints = false
          tvTitle.numberOfLines = 0
          self.contentView.addSubview(tvTitle)
          NSLayoutConstraint.activate([tvTitle.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 8),
                                       tvTitle.leftAnchor.constraint(equalTo: contentView.leftAnchor, constant: 8),
                                       tvTitle.rightAnchor.constraint(equalTo: contentView.rightAnchor, constant: -8),
                                       tvTitle.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -8)])
  
      }
  
      override func configCellWithData(baseObj: Any, index: Int) {
          super.configCellWithData(baseObj: baseObj, index: index)
1341bf603   Trịnh Văn Quân   version 1.1
37
          mucChup = baseObj as! ShootItem
d774f0637   Trịnh Văn Quân   fisrt comit
38
          tvTitle.text = mucChup.name
defd9642e   Trịnh Văn Quân   version 1.2
39
          if mucChup.willShoot == 1 {
d774f0637   Trịnh Văn Quân   fisrt comit
40
41
42
43
44
45
              self.contentView.backgroundColor = UIColor(hexString: "#1C9CF6")
          } else {
              self.contentView.backgroundColor = UIColor.white
          }
      }
  }