You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
0 B

//
// WeChatSportViewControllerss.swift
// FireBoltt
//
// Created by lemo. on 2020/10/27.
// Copyright © 2020 Sheldon. All rights reserved.
//
import UIKit
class WeChatSportViewControllerss: ViewController {
lazy var fbtitleLabel: UILabel = {
let view = UILabel()
view.text = MultiLanguageKey_FB.wechatSportStepFB.localized
view.font = SystemMediumFont(20)
view.textColor = kHexColor(0x444444)
view.numberOfLines = 0
view.textAlignment = .center
return view
}()
lazy var fbqrCodeImage: UIImageView = {
let view = UIImageView()
view.layer.cornerRadius = 10
view.layer.masksToBounds = true
return view
}()
lazy var fbsaveBtn: UIButton = {
let view = UIButton()
view.setTitle(MultiLanguageKey_FB.saveQrCodeFB.localized, for: .normal)
view.setTitleColor(kHexColor(0x414141), for: .normal)
view.titleLabel?.font = SystemMediumFont(14)
view.titleLabel?.adjustsFontSizeToFitWidth = true
view.layer.cornerRadius = 20
view.layer.borderColor = kHexColor(0x000000).cgColor
view.layer.borderWidth = 1
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
}
override func makeUI() {
super.makeUI()
view.addSubview(fbtitleLabel)
fbtitleLabel.snp.makeConstraints { (make) in
make.centerX.equalToSuperview()
make.top.equalTo(20)
make.left.equalTo(20)
make.right.equalTo(-20)
}
//
let titles = [MultiLanguageKey_FB.wechatSportStep1FB.localized, MultiLanguageKey_FB.wechatSportStep2FB.localized, MultiLanguageKey_FB.wechatSportStep3FB.localized, MultiLanguageKey_FB.wechatSportStep4FB.localized]
let images = [R.image.wechatSportStep1(), R.image.wechatSportStep2(), R.image.wechatSportStep3(), R.image.wechatSportStep4()]
for (index, title) in titles.enumerated() {
let btn = stepBtn(image: images[index], title: title)
view.addSubview(btn)
btn.snp.makeConstraints { (make) in
make.top.equalTo(fbtitleLabel.snp.bottom).offset(30 + (index * (60 + 10)))
make.centerX.equalToSuperview()
make.left.equalTo(30)
make.right.equalTo(-30)
}
}
//
view.addSubview(fbsaveBtn)
fbsaveBtn.snp.makeConstraints { (make) in
make.centerX.equalToSuperview()
make.bottom.equalTo(-20)
make.height.equalTo(40)
make.width.equalTo(120)
}
//
view.addSubview(fbqrCodeImage)
fbqrCodeImage.snp.makeConstraints { (make) in
make.centerX.equalToSuperview()
make.bottom.equalTo(fbsaveBtn.snp.top).offset(-30)
make.width.height.equalTo(kScaleWidth(120))
}
}
private func stepBtn(image: UIImage?, title: String) -> UIView {
let bgImageView = UIImageView(image: image)
let titleLabel = UILabel()
titleLabel.textColor = kHexColor(0x414141)
titleLabel.font = SystemMediumFont(12)
titleLabel.text = title
titleLabel.numberOfLines = 0
titleLabel.adjustsFontSizeToFitWidth = true
bgImageView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { (make) in
make.centerY.equalToSuperview().offset(-5)
make.left.equalTo(45)
make.right.equalToSuperview()
}
return bgImageView
}
override func bindViewModel() {
guard let viewModel = viewModel as? WeChatSportViewModelss else { return }
let output = viewModel.transform(input: WeChatSportViewModelss.Input(saveQrCode: fbsaveBtn.rx.tap.asObservable()))
output.qrCodeImage.asDriver()
.drive(fbqrCodeImage.rx.image)
.disposed(by: rx.disposeBag)
}
}