// // SearchLocationHeaderView.swift // QuickLocation // import UIKit /// 查位置页共用顶部:hero + 双标题 final class SearchLocationHeaderView: UIView { let headlineLab = UILabel() let subheadLab = UILabel() let heroImageView = UIImageView() override init(frame: CGRect) { super.init(frame: frame) setupUI() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } private func setupUI() { addSubview(heroImageView) addSubview(headlineLab) addSubview(subheadLab) heroImageView.backgroundColor = .clear heroImageView.contentMode = .scaleAspectFit heroImageView.image = UIImage(named: "SearchLocation/header_bg") heroImageView.layoutChain .top() .centerX() .width(288) .height(190) headlineLab.text = "实时查看TA的位置" headlineLab.font = FontManager.boboBold(30) headlineLab.textColor = UIColor(hexStr: "#293445") headlineLab.textAlignment = .center headlineLab.layoutChain .topToBottomOfView(heroImageView, offset: 67) .centerX() subheadLab.text = "为你安心守护出行安全" subheadLab.font = .systemFont(ofSize: 18, weight: .bold) subheadLab.textColor = UIColor(hexStr: "#293445") subheadLab.textAlignment = .center subheadLab.layoutChain .topToBottomOfView(headlineLab, offset: 20) .centerX() .bottom() } }