//
|
// CarDetailHeaderVC.swift
|
// OKProject
|
//
|
// Created by 无故事王国 on 2022/5/10.
|
// Copyright © 2022 yangwang. All rights reserved.
|
//
|
|
import UIKit
|
|
class CarDetailHeaderVC: YYViewController {
|
|
var bannerView:BannerView!
|
var carTypeL:UILabel!
|
private var bannerNum:UILabel!
|
|
override func viewDidLoad() {
|
super.viewDidLoad()
|
|
}
|
|
override func setupViews() {
|
super.setupViews()
|
|
bannerView = BannerView()
|
view.addSubview(bannerView)
|
view.sendSubviewToBack(bannerView)
|
bannerView.frame = CGRect(x: 0, y: 0, width: ScreenWidth, height: ScreenWidth * 0.8)
|
|
carTypeL = UILabel()
|
carTypeL.font = UIFont.systemFont(ofSize: 12, weight: .medium)
|
carTypeL.textAlignment = .center
|
carTypeL.backgroundColor = UIColor(hexString: "#FF8A3D")!.withAlphaComponent(0.79)
|
carTypeL.textColor = .white
|
carTypeL.maskToBounds = true
|
carTypeL.cornerRadius = 4
|
view.addSubview(carTypeL)
|
carTypeL.snp.makeConstraints { make in
|
make.bottom.equalTo(bannerView.snp.bottom).offset(-8)
|
make.left.equalTo(15)
|
make.width.equalTo(56)
|
make.height.equalTo(20)
|
}
|
|
bannerNum = UILabel()
|
bannerNum.text = "0/0"
|
bannerNum.font = UIFont.systemFont(ofSize: 14, weight: .medium)
|
bannerNum.textAlignment = .right
|
bannerNum.textColor = .white
|
view.addSubview(bannerNum)
|
bannerNum.snp.makeConstraints { make in
|
make.bottom.equalTo(bannerView.snp.bottom).offset(-8)
|
make.right.equalTo(-14)
|
make.height.equalTo(20)
|
}
|
|
|
bannerView.changeAtIndex { [weak self] current, totalNum in
|
if current <= -1{
|
self?.bannerNum.text = "\(totalNum)/\(totalNum)"
|
}else{
|
self?.bannerNum.text = "\(current + 1)/\(totalNum)"
|
}
|
}
|
}
|
|
func setImgs(_ imgUrls:[String]){
|
bannerView.setImages(images: imgUrls, type: .URL) { index in
|
|
}
|
}
|
}
|