Commit 43f328da authored by Steven杜宇's avatar Steven杜宇

// AI

parent 37f9405b
......@@ -17,9 +17,9 @@ class YHAIProductCell: UICollectionViewCell {
titleLabel.text = model.title
subtitleLabel.text = model.description
if !model.btnText.isEmpty {
blackButton.setTitle(model.btnText, for: .normal)
blackTitleLabel.text = model.btnText
} else {
blackButton.setTitle("去了解", for: .normal)
blackTitleLabel.text = "去了解"
}
bgImgView.sd_setImage(with: URL(string: model.cover), placeholderImage: UIImage(named: "ai_product_bg_default"))
}
......@@ -48,22 +48,29 @@ class YHAIProductCell: UICollectionViewCell {
return lable
}()
lazy var blackButton: UIButton = {
let btn = UIButton(type: .custom)
btn.setTitle("去了解", for: .normal)
btn.setTitleColor(.white, for: .normal)
btn.titleLabel?.font = .PFSC_M(ofSize: 11)
btn.backgroundColor = .black
btn.addTarget(self, action: #selector(didSendButtonClicked), for: .touchUpInside)
btn.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
btn.layer.cornerRadius = 13.0
btn.clipsToBounds = true
return btn
lazy var blackView: UIView = {
let v = UIView()
v.backgroundColor = .black
v.layer.cornerRadius = 13.0
v.clipsToBounds = true
v.addSubview(blackTitleLabel)
blackTitleLabel.snp.makeConstraints { make in
make.left.equalTo(10)
make.right.equalTo(-10)
make.top.bottom.equalToSuperview()
}
return v
}()
@objc func didSendButtonClicked() {
}
lazy var blackTitleLabel: UILabel = {
let lable = UILabel()
lable.textColor = UIColor.white
lable.textAlignment = .left
lable.font = UIFont.PFSC_M(ofSize: 11)
lable.text = "去了解"
return lable
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
......@@ -82,7 +89,7 @@ class YHAIProductCell: UICollectionViewCell {
contentView.addSubview(bgImgView)
bgImgView.addSubview(titleLabel)
bgImgView.addSubview(subtitleLabel)
bgImgView.addSubview(blackButton)
bgImgView.addSubview(blackView)
bgImgView.snp.makeConstraints { make in
make.left.equalTo(0)
......@@ -101,14 +108,14 @@ class YHAIProductCell: UICollectionViewCell {
subtitleLabel.snp.makeConstraints { make in
make.left.equalTo(22)
make.right.equalTo(-22)
make.bottom.equalTo(blackButton.snp.top).offset(-12)
make.bottom.equalTo(blackView.snp.top).offset(-12)
}
blackButton.snp.makeConstraints { make in
blackView.snp.makeConstraints { make in
make.left.equalTo(22)
make.bottom.equalTo(-24)
make.height.equalTo(26)
make.width.equalTo(54)
make.right.lessThanOrEqualTo(-22)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment