108 lines
2.6 KiB
Swift
108 lines
2.6 KiB
Swift
//
|
|
// ItineraryDetailView.swift
|
|
// QuickLocation
|
|
//
|
|
// Created by 八条 on 2026/6/26.
|
|
//
|
|
|
|
import UIKit
|
|
import RxSwift
|
|
import RxCocoa
|
|
import AMapNaviKit
|
|
|
|
class ItineraryDetailView: UIView {
|
|
|
|
var disposeBag = DisposeBag()
|
|
|
|
private func setupRx() {
|
|
backBtn.rx.tap.subscribe(onNext: { _ in
|
|
AppRouter.shared.popOrDismiss()
|
|
}).disposed(by: disposeBag)
|
|
}
|
|
|
|
private func setupUI() {
|
|
addSubview(mapView)
|
|
addSubview(navBgView)
|
|
addSubview(navBarView)
|
|
navBarView.addSubview(navTitleLabel)
|
|
navBarView.addSubview(backBtn)
|
|
|
|
navBgView.layoutChain
|
|
.edges(excludingEdge: .bottom)
|
|
.heightToWidth(160/375)
|
|
|
|
navBarView.layoutChain
|
|
.edges(excludingEdge: .bottom)
|
|
.height(kNaviHeight)
|
|
|
|
navTitleLabel.layoutChain
|
|
.top(kStatusBarHeight + 12)
|
|
.centerY(backBtn)
|
|
.centerX()
|
|
|
|
backBtn.layoutChain
|
|
.centerY(navTitleLabel)
|
|
.left(15)
|
|
.width(24)
|
|
.height(24)
|
|
|
|
mapView.layoutChain
|
|
.edges()
|
|
}
|
|
|
|
lazy var navBgView: UIImageView = {
|
|
let iv = UIImageView()
|
|
iv.image = UIImage(named: "Common/navBar_bg_2")
|
|
iv.contentMode = .scaleAspectFill
|
|
return iv
|
|
}()
|
|
|
|
lazy var navBarView: UIView = {
|
|
let view = UIView()
|
|
view.backgroundColor = .clear
|
|
return view
|
|
}()
|
|
|
|
lazy var navTitleLabel: UILabel = {
|
|
let label = UILabel()
|
|
label.text = "行程路线"
|
|
label.font = .systemFont(ofSize: 18, weight: .medium)
|
|
label.textColor = ThemeManager.shared.color.titleAuxColor
|
|
label.textAlignment = .center
|
|
return label
|
|
}()
|
|
|
|
lazy var backBtn: UIButton = {
|
|
let btn = UIButton(type: .custom)
|
|
btn.setImage(UIImage(named: "Common/back"), for: .normal)
|
|
btn.extendEdgeInsets = UIEdgeInsets(top: 54, left: 15, bottom: 100, right: 100)
|
|
return btn
|
|
}()
|
|
|
|
lazy var mapView: MAMapView! = {
|
|
let mv = MAMapView()
|
|
mv.zoomLevel = 14
|
|
mv.showsUserLocation = false
|
|
mv.showsCompass = false
|
|
mv.userTrackingMode = .none
|
|
return mv
|
|
}()
|
|
|
|
func cleanupMap() {
|
|
mapView?.delegate = nil
|
|
mapView?.removeFromSuperview()
|
|
mapView = nil
|
|
}
|
|
|
|
override init(frame: CGRect) {
|
|
super.init(frame: .zero)
|
|
backgroundColor = .white
|
|
setupUI()
|
|
setupRx()
|
|
}
|
|
|
|
required init?(coder aDecoder: NSCoder) {
|
|
fatalError("init(coder:) has not been implemented")
|
|
}
|
|
}
|