94 lines
2.7 KiB
Swift
94 lines
2.7 KiB
Swift
//
|
|
// CreateBubbleView.swift
|
|
// QuickLocation
|
|
//
|
|
|
|
import UIKit
|
|
import RxSwift
|
|
import RxCocoa
|
|
import SwiftDate
|
|
|
|
class CreateBubbleView: UIView {
|
|
|
|
var disposeBag = DisposeBag()
|
|
|
|
let setupView = CreateBubbleSetupView()
|
|
let doneView = CreateBubbleDoneView()
|
|
|
|
let moreBtn: UIButton = {
|
|
let btn = UIButton(type: .custom)
|
|
btn.setImage(UIImage(systemName: "ellipsis"), for: .normal)
|
|
btn.tintColor = UIColor(hexStr: "#293445")
|
|
btn.backgroundColor = UIColor.white.withAlphaComponent(0.9)
|
|
btn.layer.cornerRadius = 8
|
|
btn.layer.borderWidth = 1
|
|
btn.layer.borderColor = UIColor(hexStr: "#E8E8E8").cgColor
|
|
return btn
|
|
}()
|
|
|
|
lazy var navBgView: UIImageView = {
|
|
let iv = UIImageView()
|
|
iv.image = UIImage(named: "Common/navBar_bg_2")
|
|
iv.contentMode = .scaleAspectFill
|
|
iv.isHidden = true
|
|
return iv
|
|
}()
|
|
|
|
lazy var navView: BaseNavigationView = {
|
|
BaseNavigationView(title: "设置气泡时间")
|
|
}()
|
|
|
|
override init(frame: CGRect) {
|
|
super.init(frame: frame)
|
|
backgroundColor = .white
|
|
setupUI()
|
|
showSetup(animated: false)
|
|
}
|
|
|
|
required init?(coder aDecoder: NSCoder) {
|
|
fatalError("init(coder:) has not been implemented")
|
|
}
|
|
|
|
private func setupUI() {
|
|
addSubview(navBgView)
|
|
addSubview(navView)
|
|
addSubview(setupView)
|
|
addSubview(doneView)
|
|
|
|
navBgView.layoutChain.edges(excludingEdge: .bottom).heightToWidth(160 / 375)
|
|
navView.layoutChain.edges(excludingEdge: .bottom).height(kNaviHeight)
|
|
navView.addRightButton(moreBtn)
|
|
moreBtn.layoutChain.width(36).height(36)
|
|
|
|
setupView.layoutChain.topToBottomOfView(navView).edges(excludingEdge: .top)
|
|
doneView.layoutChain.topToBottomOfView(navView).edges(excludingEdge: .top)
|
|
}
|
|
|
|
func showSetup(animated: Bool) {
|
|
doneView.isHidden = true
|
|
setupView.isHidden = false
|
|
moreBtn.isHidden = false
|
|
navView.titleLabel.text = setupView.isSheetVisible ? "通知您的圈子" : "设置气泡时间"
|
|
if animated {
|
|
setupView.alpha = 0
|
|
UIView.animate(withDuration: 0.25) { self.setupView.alpha = 1 }
|
|
}
|
|
}
|
|
|
|
func showDone(animated: Bool) {
|
|
setupView.isHidden = true
|
|
doneView.isHidden = false
|
|
moreBtn.isHidden = false
|
|
navView.titleLabel.text = "活动气泡"
|
|
doneView.heroView.reloadAvatar()
|
|
if animated {
|
|
doneView.alpha = 0
|
|
UIView.animate(withDuration: 0.25) { self.doneView.alpha = 1 }
|
|
}
|
|
}
|
|
|
|
func updateNavTitleForSheet(_ visible: Bool) {
|
|
navView.titleLabel.text = visible ? "通知您的圈子" : "设置气泡时间"
|
|
}
|
|
}
|