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
109 lines
0 B
1 year ago
|
//
|
||
1 year ago
|
// WeChatSportViewControllerss.swift
|
||
1 year ago
|
// FireBoltt
|
||
1 year ago
|
//
|
||
|
// Created by lemo. on 2020/10/27.
|
||
|
// Copyright © 2020 Sheldon. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import UIKit
|
||
|
|
||
1 year ago
|
class WeChatSportViewControllerss: ViewController {
|
||
1 year ago
|
|
||
1 year ago
|
lazy var fbtitleLabel: UILabel = {
|
||
1 year ago
|
let view = UILabel()
|
||
1 year ago
|
view.text = MultiLanguageKey_FB.wechatSportStepFB.localized
|
||
1 year ago
|
view.font = SystemMediumFont(20)
|
||
|
view.textColor = kHexColor(0x444444)
|
||
|
view.numberOfLines = 0
|
||
|
view.textAlignment = .center
|
||
|
return view
|
||
|
}()
|
||
1 year ago
|
lazy var fbqrCodeImage: UIImageView = {
|
||
1 year ago
|
let view = UIImageView()
|
||
|
view.layer.cornerRadius = 10
|
||
|
view.layer.masksToBounds = true
|
||
|
return view
|
||
|
}()
|
||
1 year ago
|
lazy var fbsaveBtn: UIButton = {
|
||
1 year ago
|
let view = UIButton()
|
||
1 year ago
|
view.setTitle(MultiLanguageKey_FB.saveQrCodeFB.localized, for: .normal)
|
||
1 year ago
|
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()
|
||
1 year ago
|
view.addSubview(fbtitleLabel)
|
||
|
fbtitleLabel.snp.makeConstraints { (make) in
|
||
1 year ago
|
make.centerX.equalToSuperview()
|
||
|
make.top.equalTo(20)
|
||
|
make.left.equalTo(20)
|
||
|
make.right.equalTo(-20)
|
||
|
}
|
||
|
// 步骤添加
|
||
1 year ago
|
let titles = [MultiLanguageKey_FB.wechatSportStep1FB.localized, MultiLanguageKey_FB.wechatSportStep2FB.localized, MultiLanguageKey_FB.wechatSportStep3FB.localized, MultiLanguageKey_FB.wechatSportStep4FB.localized]
|
||
1 year ago
|
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
|
||
1 year ago
|
make.top.equalTo(fbtitleLabel.snp.bottom).offset(30 + (index * (60 + 10)))
|
||
1 year ago
|
make.centerX.equalToSuperview()
|
||
|
make.left.equalTo(30)
|
||
|
make.right.equalTo(-30)
|
||
|
}
|
||
|
}
|
||
|
// 保存按钮
|
||
1 year ago
|
view.addSubview(fbsaveBtn)
|
||
|
fbsaveBtn.snp.makeConstraints { (make) in
|
||
1 year ago
|
make.centerX.equalToSuperview()
|
||
|
make.bottom.equalTo(-20)
|
||
|
make.height.equalTo(40)
|
||
|
make.width.equalTo(120)
|
||
|
}
|
||
|
// 二维码
|
||
1 year ago
|
view.addSubview(fbqrCodeImage)
|
||
|
fbqrCodeImage.snp.makeConstraints { (make) in
|
||
1 year ago
|
make.centerX.equalToSuperview()
|
||
1 year ago
|
make.bottom.equalTo(fbsaveBtn.snp.top).offset(-30)
|
||
1 year ago
|
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() {
|
||
1 year ago
|
guard let viewModel = viewModel as? WeChatSportViewModelss else { return }
|
||
1 year ago
|
let output = viewModel.transform(input: WeChatSportViewModelss.Input(saveQrCode: fbsaveBtn.rx.tap.asObservable()))
|
||
1 year ago
|
output.qrCodeImage.asDriver()
|
||
1 year ago
|
.drive(fbqrCodeImage.rx.image)
|
||
1 year ago
|
.disposed(by: rx.disposeBag)
|
||
|
}
|
||
|
|
||
|
}
|