Blame view
App/createNew/CellMucChupWithCamera.swift
2.13 KB
|
d774f0637
|
1 2 3 4 5 6 7 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
import Foundation
import UIKit
class CellMucChupWithCamera: BaseTableViewCellUI {
var tvTitle: UILabel!, imv: UIImageView!
var mucChup: MucChup!
static func registerClass(tableView: UITableView, forCellReuseIdentifier: String) {
tableView.register(CellMucChupWithCamera.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() {
let stackView = UIStackView()
stackView.axis = UILayoutConstraintAxis.horizontal
stackView.spacing = 8
stackView.translatesAutoresizingMaskIntoConstraints = false
self.contentView.addSubview(stackView)
NSLayoutConstraint.activate([stackView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 15),
stackView.leftAnchor.constraint(equalTo: contentView.leftAnchor, constant: 15),
stackView.rightAnchor.constraint(equalTo: contentView.rightAnchor, constant: -15),
stackView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -15)])
tvTitle = UILabel()
tvTitle.numberOfLines = 0
stackView.addArrangedSubview(tvTitle)
imv = UIImageView()
imv.contentMode = .scaleAspectFit
imv.isUserInteractionEnabled = true
stackView.addArrangedSubview(imv)
imv.widthAnchor.constraint(equalToConstant: 33).isActive = true
imv.image = #imageLiteral(resourceName:"camera_black_ic")
let tap = UITapGestureRecognizer(target: self, action: #selector(CellMucChupWithCamera.btnImvClick))
imv.addGestureRecognizer(tap)
}
func btnImvClick() {
}
override func configCellWithData(baseObj: Any, index: Int) {
super.configCellWithData(baseObj: baseObj, index: index)
mucChup = baseObj as! MucChup
tvTitle.text = mucChup.name
}
}
|