NFCAnalogVC.swift
2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// NFCAnalogVC.swift
// Twear
//
// Created by yangbin on 2022/2/12.
//
import UIKit
import YYText
import MBProgressHUD
class NFCAnalogVC: UIViewController {
@IBOutlet weak var agreementLabel: YYLabel!
@IBOutlet weak var agreementBtn: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
title = LocString("录入模拟门卡")
let str = LocString("我已阅读并同意") + LocString("《用户协议》")
let text = NSMutableAttributedString(string: str, attributes: [.font: RegularFont(11), .foregroundColor: UIColor.rgbColorFromHex(0x808080)])
let range = NSRange(text.string.range(of: LocString("《用户协议》"))!, in: "")
text.yy_setTextHighlight(range, color: TintColor, backgroundColor: .clear) {[weak self] (containerView, text, range, rect) in
let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Setting", identifier: "NFCAgreementVC")
self?.navigationController?.pushViewController(vc, animated: true)
print("123")
}
// text.yy_setTextUnderline(YYTextDecoration(style: .single, width: 1, color: UIColor.rgbColorFromHex(0xDD000B)), range: range)
agreementLabel.attributedText = text
// Do any additional setup after loading the view.
}
@IBAction func agreement(_ sender: UIButton) {
sender.isSelected = !sender.isSelected
sender.setImage(UIImage(named: sender.isSelected ? "selected" : "not_selected"), for: .normal)
}
@IBAction func createCard(_ sender: UIButton) {
if !agreementBtn.isSelected {
MBProgressHUD.show(LocString("请先同意用户协议"))
return
}
let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Setting", identifier: "NFCDetectVC")
navigationController?.pushViewController(vc, animated: true)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}