SettingsView.swift
3.65 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//
// SettingsView.swift
// InterQR-Internship
//
// Created by Дмитрий Тимофеев on 08.06.2022.
//
import UIKit
class SettingsView: UIView {
var backButton: UIButton = {
var obj = UIButton()
obj.setImage(UIImage(named: "BackPointer"), for: .normal)
obj.backgroundColor = .white
obj.layer.borderColor = UIColor(red: 224/255, green: 231/255, blue: 232/255, alpha: 1).cgColor
obj.layer.cornerRadius = 13
obj.layer.borderWidth = 1
return obj
}()
var logoImage: UIImageView = {
var obj = UIImageView()
obj.image = UIImage(named: "InterQR")
return obj
}()
var gearImage: UIImageView = {
var obj = UIImageView()
obj.image = UIImage(named: "Gear")
return obj
}()
var settingsLabel: UILabel = {
var obj = UILabel()
obj.font = .skModernist(type: .bold, ofSize: 35)
obj.text = "Settings"
return obj
}()
var profileView: ProfileView = {
var obj = ProfileView()
return obj
}()
var notificationsView: NotificationsView = {
var obj = NotificationsView()
return obj
}()
var editInfo: EditInfoView = {
var obj = EditInfoView()
return obj
}()
var logoutButton: UIButton = {
var obj = UIButton()
obj.backgroundColor = UIColor(red: 1, green: 0, blue: 0.18, alpha: 0.07)
obj.setTitle("Logout", for: .normal)
obj.setTitleColor(UIColor(red: 1, green: 0, blue: 0.18, alpha: 0.98), for: .normal)
obj.layer.cornerRadius = 15
return obj
}()
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .white
layout()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func layout() {
addSubview(backButton)
addSubview(logoImage)
addSubview(gearImage)
addSubview(settingsLabel)
addSubview(profileView)
addSubview(notificationsView)
addSubview(editInfo)
addSubview(logoutButton)
backButton.snp.makeConstraints {
$0.top.equalTo(snp.top).offset(66)
$0.leading.equalTo(snp.leading).offset(25)
$0.height.width.equalTo(45)
}
logoImage.snp.makeConstraints {
$0.leading.equalTo(backButton.snp.trailing).offset(20)
$0.top.equalTo(snp.top).offset(79)
}
gearImage.snp.makeConstraints {
$0.trailing.equalTo(snp.trailing)
$0.top.equalTo(snp.top).offset(106)
}
settingsLabel.snp.makeConstraints {
$0.leading.equalTo(backButton.snp.leading)
$0.top.equalTo(backButton.snp.bottom).offset(46)
}
profileView.snp.makeConstraints {
$0.top.equalTo(settingsLabel.snp.bottom).offset(85)
$0.leading.equalTo(snp.leading)
$0.trailing.equalTo(snp.trailing)
$0.height.equalTo(140)
}
notificationsView.snp.makeConstraints {
$0.top.equalTo(profileView.snp.bottom)
$0.leading.trailing.equalToSuperview()
$0.height.equalTo(140)
}
editInfo.snp.makeConstraints {
$0.top.equalTo(notificationsView.snp.bottom)
$0.leading.trailing.equalToSuperview()
$0.height.equalTo(102)
}
logoutButton.snp.makeConstraints {
$0.top.equalTo(editInfo.snp.bottom).offset(42)
$0.leading.equalTo(snp.leading).offset(25)
$0.trailing.equalTo(snp.trailing).offset(-26)
$0.height.equalTo(56)
}
}
}