// // QSLHomeFriendFooterView.swift // QuickSearchLocation // // Created by Destiny on 2024/11/25. // import UIKit protocol QSLHomeFriendFooterViewDelegate: NSObjectProtocol { func addButtonAction() } class QSLHomeFriendFooterView: UIView { weak var delegate: QSLHomeFriendFooterViewDelegate? lazy var bgView: UIView = { let view = UIView() view.backgroundColor = .white view.addRadius(radius: 8.rpx) return view }() lazy var mainImageView: UIImageView = { let imageView = UIImageView() imageView.image = UIImage(named: "home_friends_footer_icon") return imageView }() lazy var addButton: UIButton = { let btn = UIButton() btn.addRadius(radius: 22.rpx) btn.gradientBackgroundColor(color1: .hexStringColor(hexString: "#15CBA1"), color2: .hexStringColor(hexString: "#1FE0BA"), width: 280.rpx, height: 44.rpx, direction: .horizontal) btn.image(UIImage(named: "home_friends_header_add_icon")) btn.title("查找好友") btn.mediumFont(15) btn.textColor(.white) btn.setImageTitleLayout(.imgLeft, spacing: 0) btn.addTarget(self, action: #selector(addButtonAction), for: .touchUpInside) return btn }() lazy var noMoreLabel: UILabel = { let label = UILabel() label.text("- 没有更多了 -") label.font(12) label.textColor = .hexStringColor(hexString: "#A7A7A7") return label }() override init(frame: CGRect) { super.init(frame: frame) self.addSubview(bgView) bgView.snp.makeConstraints { make in make.left.equalTo(8.rpx) make.right.equalTo(-8.rpx) make.height.equalTo(170.rpx) make.top.equalTo(0) } self.addSubview(noMoreLabel) noMoreLabel.snp.makeConstraints { make in make.centerX.equalToSuperview() make.top.equalTo(bgView.snp.bottom).offset(8.rpx) } bgView.addSubview(mainImageView) mainImageView.snp.makeConstraints { make in make.size.equalTo(CGSize(width: 106.rpx, height: 83.rpx)) make.centerX.equalToSuperview() make.top.equalTo(11.rpx) } bgView.addSubview(addButton) addButton.snp.makeConstraints { make in make.size.equalTo(CGSize(width: 280.rpx, height: 44.rpx)) make.centerX.equalToSuperview() make.top.equalTo(mainImageView.snp.bottom).offset(8.rpx) } } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } @objc func addButtonAction() { delegate?.addButtonAction() } }