CNLiveInfoShowViewController.swift
2.86 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
63
64
65
66
67
68
69
70
//
// CNLiveInfoShowViewController.swift
// metaCode
//
// Created by open on 2023/6/8.
//
import Foundation
import YYCategories
enum ListShowInfoType {
case service
case privacy
}
class CNLiveInfoShowViewController: CNLiveBaseViewController {
var _show_type:ListShowInfoType!
init(show_type:ListShowInfoType) {
super.init(nibName:nil, bundle:nil)
_show_type = show_type
}
override func viewWillAppear(_ animated: Bool) {
navigationBarHidden = false
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
var attrString = ""
switch _show_type {
case .service:
titleName = "APP用户服务协议"
attrString = "欢迎您使用元码,我们非常重视您的个人信息保护,并采取了有效措施保障您的信息安全,请您充分了解: \n为保障APP账号安全,元码APP需向您申请获取电话状态权限。 \n请您务必阅读APP《个人信息保护政策》,以充分了解我们如何处理您的个人信息。"
case .privacy:
titleName = "个人信息保护政策"
attrString = "欢迎您使用元码,我们非常重视您的个人信息保护,并采取了有效措施保障您的信息安全,请您充分了解: \n为保障APP账号安全,元码APP需向您申请获取电话状态权限 \n请您务必阅读APP《个人信息保护政策》,以充分了解我们如何处理您的个人信息。"
case .none:
break
}
let paraph = NSMutableParagraphStyle()
paraph.lineSpacing = 10
let attributes = [NSAttributedString.Key.font:Font_16_Fit,
NSAttributedString.Key.paragraphStyle: paraph]
let h = attrString.boundingRect(with: CGSize(width: KSreenWidth - 40, height: CGFloat(MAXFLOAT)), options: .usesLineFragmentOrigin, attributes: attributes, context: nil).size.height + 40
let textView = UITextView.init()
textView.attributedText = NSAttributedString(string: attrString, attributes: attributes)
textView.textColor = HexColor("#666666")
textView.layer.cornerRadius = 10
textView.layer.masksToBounds = true
textView.textAlignment = .left
textView.contentMode = .scaleAspectFill
textView.contentInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
textView.sizeToFit()
view.addSubview(textView)
textView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalToSuperview().offset(get_system_nav_height() + 10)
make.left.equalToSuperview().offset(10)
make.right.equalToSuperview().offset(-10)
make.height.equalTo(h)
}
}
}