Files
yingmeng-ios-switf/yinmeng-ios/Modules/Chat/View/ChatNavView.swift
2024-03-01 01:27:25 +08:00

79 lines
2.0 KiB
Swift

//
// ChatNavView.swift
// yinmeng-ios
//
// Created by MaiMang on 2024/3/1.
//
import UIKit
class ChatNavView: BaseView {
override func loadSubViews() {
addSubview(backBtn)
addSubview(titleLb)
addSubview(likeBtn)
addSubview(optBtn)
backBtn.snp.makeConstraints { make in
make.size.equalTo(CGSize(width: 18, height: 18))
make.left.equalToSuperview().offset(16)
make.bottom.equalTo(self).offset(-13)
}
titleLb.snp.makeConstraints { make in
make.centerX.equalTo(self)
make.centerY.equalTo(backBtn)
}
likeBtn.snp.makeConstraints { make in
make.size.equalTo(CGSize(width: 48, height: 21))
make.centerY.equalTo(backBtn)
make.right.equalTo(optBtn.snp.left).offset(-10)
}
optBtn.snp.makeConstraints { make in
make.size.equalTo(CGSize(width: 18, height: 18))
make.right.equalTo(self).offset(-16)
make.centerY.equalTo(backBtn)
}
}
private lazy var backBtn: UIButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(named: "chat_back"), for: .normal)
button.setImage(UIImage(named: "chat_back"), for: .selected)
return button
}()
private lazy var titleLb: UILabel = {
let label = UILabel()
label.textColor = ThemeColor(hexStr: "#2B2D33")
label.font = UIFont.systemFont(ofSize: 16, weight: .medium)
label.textAlignment = .center
return label
}()
private lazy var likeBtn: UIButton = {
let button = UIButton(type: .custom)
button.setTitle("关注", for: .normal)
button.setTitleColor(ThemeColor(hexStr: "#FFDA24"), for: .normal)
button.titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .medium)
button.layer.masksToBounds = true
button.layer.cornerRadius = 26
button.isEnabled = false
button.addTarget(self, action: #selector(likeClick), for: .touchUpInside)
return button
}()
private lazy var optBtn: UIButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(named: "chat_opt"), for: .normal)
button.setImage(UIImage(named: "chat_opt"), for: .selected)
return button
}()
@objc func likeClick() {
//TODO:
}
}