Showing
3 changed files
with
219 additions
and
7 deletions
1 | // | 1 | // |
2 | -// DisplayNameCell.swift | 2 | +// File.swift |
3 | // InterQR-Internship | 3 | // InterQR-Internship |
4 | // | 4 | // |
5 | -// Created by Дмитрий Тимофеев on 16.06.2022. | 5 | +// Created by Дмитрий Тимофеев on 15.06.2022. |
6 | // | 6 | // |
7 | 7 | ||
8 | -import Foundation | 8 | +import UIKit |
9 | + | ||
10 | +class DisplayNameCell: UITableViewCell, Reusable { | ||
11 | + var settingsIcon: UIImageView = { | ||
12 | + var obj = UIImageView() | ||
13 | + obj.image = UIImage(named: "Profile") | ||
14 | + return obj | ||
15 | + }() | ||
16 | + var titleLabel: UILabel = { | ||
17 | + var obj = UILabel() | ||
18 | + obj.text = "Your display name" | ||
19 | + obj.font = .skModernist(type: .bold, ofSize: 16) | ||
20 | + obj.textColor = UIColor(red: 0.196, green: 0.216, blue: 0.333, alpha: 1) | ||
21 | + return obj | ||
22 | + }() | ||
23 | + var descriptionLabel: UILabel = { | ||
24 | + var obj = UILabel() | ||
25 | + obj.text = "This name will be displayed everywhere" | ||
26 | + obj.font = .skModernist(type: .regular, ofSize: 14) | ||
27 | + obj.textColor = UIColor(red: 0.725, green: 0.725, blue: 0.725, alpha: 1) | ||
28 | + return obj | ||
29 | + }() | ||
30 | + var displayNameTextField: UITextField = { | ||
31 | + var obj = UITextField() | ||
32 | + obj.text = "John Doe" | ||
33 | + obj.returnKeyType = .done | ||
34 | + obj.backgroundColor = UIColor(red: 0.971, green: 0.967, blue: 0.967, alpha: 1) | ||
35 | + obj.clipsToBounds = true | ||
36 | + obj.layer.cornerRadius = 15 | ||
37 | + return obj | ||
38 | + }() | ||
39 | + | ||
40 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
41 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
42 | + setup() | ||
43 | + } | ||
44 | + | ||
45 | + required init?(coder: NSCoder) { | ||
46 | + super.init(coder: coder) | ||
47 | + setup() | ||
48 | + } | ||
49 | + | ||
50 | + private func setup() { | ||
51 | + contentView.addSubview(settingsIcon) | ||
52 | + contentView.addSubview(titleLabel) | ||
53 | + contentView.addSubview(descriptionLabel) | ||
54 | + contentView.addSubview(displayNameTextField) | ||
55 | + | ||
56 | + settingsIcon.snp.makeConstraints { make in | ||
57 | + make.top.equalToSuperview() | ||
58 | + make.leading.equalTo(snp.leading).offset(32) | ||
59 | + } | ||
60 | + titleLabel.snp.makeConstraints { make in | ||
61 | + make.top.equalTo(settingsIcon.snp.top) | ||
62 | + make.leading.equalTo(settingsIcon.snp.trailing).offset(18) | ||
63 | + } | ||
64 | + descriptionLabel.snp.makeConstraints { make in | ||
65 | + make.top.equalTo(titleLabel.snp.bottom).offset(5) | ||
66 | + make.leading.equalTo(titleLabel.snp.leading) | ||
67 | + } | ||
68 | + displayNameTextField.snp.makeConstraints { make in | ||
69 | + make.top.equalTo(descriptionLabel.snp.bottom).offset(20) | ||
70 | + make.leading.equalTo(snp.leading).offset(66) | ||
71 | + make.trailing.equalTo(snp.trailing).offset(-28) | ||
72 | + make.height.equalTo(47) | ||
73 | + make.bottom.equalToSuperview().offset(-30) | ||
74 | + } | ||
75 | + | ||
76 | + } | ||
77 | +} | ||
78 | + |
1 | // | 1 | // |
2 | -// SettingsSwichCell.swift | 2 | +// SettingsSwitchCell.swift |
3 | // InterQR-Internship | 3 | // InterQR-Internship |
4 | // | 4 | // |
5 | -// Created by Дмитрий Тимофеев on 16.06.2022. | 5 | +// Created by Дмитрий Тимофеев on 15.06.2022. |
6 | // | 6 | // |
7 | 7 | ||
8 | -import Foundation | 8 | +import UIKit |
9 | + | ||
10 | +class SettingsSwitchCell: UITableViewCell, Reusable { | ||
11 | + | ||
12 | + var settingsIcon: UIImageView = { | ||
13 | + var obj = UIImageView() | ||
14 | + obj.image = UIImage(named: "Notification") | ||
15 | + return obj | ||
16 | + }() | ||
17 | + | ||
18 | + var titleLabel: UILabel = { | ||
19 | + var obj = UILabel() | ||
20 | + obj.text = "Do not disturb" | ||
21 | + obj.textColor = UIColor(red: 0.196, green: 0.216, blue: 0.333, alpha: 1) | ||
22 | + obj.font = .skModernist(type: .bold, ofSize: 16) | ||
23 | + return obj | ||
24 | + }() | ||
25 | + | ||
26 | + var descriptionLabel: UILabel = { | ||
27 | + var obj = UILabel() | ||
28 | + obj.text = "You will not be notified of any calls for one day. Auto reset at midnight" | ||
29 | + obj.textColor = UIColor(red: 0.725, green: 0.725, blue: 0.725, alpha: 1) | ||
30 | + obj.font = .skModernist(type: .regular, ofSize: 14) | ||
31 | + obj.numberOfLines = 0 | ||
32 | + return obj | ||
33 | + }() | ||
34 | + | ||
35 | + var notificationSwitch: UISwitch = { | ||
36 | + var obj = UISwitch() | ||
37 | + obj.isOn = false | ||
38 | + obj.clipsToBounds = true | ||
39 | + return obj | ||
40 | + }() | ||
41 | + | ||
42 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
43 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
44 | + setup() | ||
45 | + } | ||
46 | + | ||
47 | + required init?(coder: NSCoder) { | ||
48 | + super.init(coder: coder) | ||
49 | + setup() | ||
50 | + } | ||
51 | + | ||
52 | + func setup() { | ||
53 | + selectionStyle = .none | ||
54 | + contentView.addSubview(settingsIcon) | ||
55 | + contentView.addSubview(titleLabel) | ||
56 | + contentView.addSubview(descriptionLabel) | ||
57 | + contentView.addSubview(notificationSwitch) | ||
58 | + | ||
59 | + settingsIcon.snp.makeConstraints { make in | ||
60 | + make.leading.equalToSuperview().offset(31) | ||
61 | + make.top.equalToSuperview().offset(38) | ||
62 | + } | ||
63 | + titleLabel.snp.makeConstraints { make in | ||
64 | + make.leading.equalTo(settingsIcon.snp.trailing).offset(17.5) | ||
65 | + make.top.equalToSuperview().offset(38) | ||
66 | + } | ||
67 | + descriptionLabel.snp.makeConstraints { make in | ||
68 | + make.top.equalTo(titleLabel.snp.bottom).offset(5) | ||
69 | + make.leading.equalTo(titleLabel.snp.leading) | ||
70 | + make.bottom.equalToSuperview().offset(-22) | ||
71 | + } | ||
72 | + notificationSwitch.snp.makeConstraints { make in | ||
73 | + make.top.equalTo(snp.top).offset(36) | ||
74 | + make.trailing.equalTo(snp.trailing).offset(-28) | ||
75 | + } | ||
76 | + } | ||
77 | + | ||
78 | +} | ||
79 | + | ||
80 | + |
@@ -2,7 +2,77 @@ | @@ -2,7 +2,77 @@ | ||
2 | // SettingsTableViewCell.swift | 2 | // SettingsTableViewCell.swift |
3 | // InterQR-Internship | 3 | // InterQR-Internship |
4 | // | 4 | // |
5 | -// Created by Дмитрий Тимофеев on 16.06.2022. | 5 | +// Created by Дмитрий Тимофеев on 15.06.2022. |
6 | // | 6 | // |
7 | 7 | ||
8 | import Foundation | 8 | import Foundation |
9 | + | ||
10 | +import UIKit | ||
11 | + | ||
12 | +class SettingsTableViewCell: UITableViewCell, Reusable { | ||
13 | + | ||
14 | + var settingsIcon: UIImageView = { | ||
15 | + var obj = UIImageView() | ||
16 | + obj.image = UIImage(named: "Edit") | ||
17 | + obj.contentMode = .scaleAspectFill | ||
18 | + return obj | ||
19 | + }() | ||
20 | + | ||
21 | + var titleLabel: UILabel = { | ||
22 | + var obj = UILabel() | ||
23 | + obj.text = "Edit residents" | ||
24 | + obj.textColor = UIColor(red: 0.196, green: 0.216, blue: 0.333, alpha: 1) | ||
25 | + obj.font = .skModernist(type: .bold, ofSize: 16) | ||
26 | + return obj | ||
27 | + }() | ||
28 | + var descriptionLabel: UILabel = { | ||
29 | + var obj = UILabel() | ||
30 | + obj.text = "Edit the residents and their information" | ||
31 | + obj.textColor = UIColor(red: 0.725, green: 0.725, blue: 0.725, alpha: 1) | ||
32 | + obj.font = .skModernist(type: .regular, ofSize: 14) | ||
33 | + return obj | ||
34 | + }() | ||
35 | + var arrowImageView: UIImageView = { | ||
36 | + var obj = UIImageView() | ||
37 | + obj.image = UIImage(named: "NextPointer") | ||
38 | + return obj | ||
39 | + }() | ||
40 | + | ||
41 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
42 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
43 | + setup() | ||
44 | + } | ||
45 | + | ||
46 | + required init?(coder: NSCoder) { | ||
47 | + super.init(coder: coder) | ||
48 | + setup() | ||
49 | + } | ||
50 | + | ||
51 | + func setup() { | ||
52 | + selectionStyle = .none | ||
53 | + contentView.addSubview(settingsIcon) | ||
54 | + contentView.addSubview(titleLabel) | ||
55 | + contentView.addSubview(descriptionLabel) | ||
56 | + contentView.addSubview(arrowImageView) | ||
57 | + | ||
58 | + settingsIcon.snp.makeConstraints { make in | ||
59 | + make.top.equalToSuperview().offset(26) | ||
60 | + make.leading.equalToSuperview().offset(32) | ||
61 | + make.height.width.equalTo(18) | ||
62 | + } | ||
63 | + titleLabel.snp.makeConstraints { make in | ||
64 | + make.top.equalToSuperview().offset(26) | ||
65 | + make.leading.equalTo(settingsIcon.snp.trailing).offset(15) | ||
66 | + } | ||
67 | + descriptionLabel.snp.makeConstraints { make in | ||
68 | + make.top.equalTo(titleLabel.snp.bottom).offset(5) | ||
69 | + make.leading.equalTo(titleLabel.snp.leading) | ||
70 | + make.bottom.equalToSuperview().offset(-22) | ||
71 | + } | ||
72 | + arrowImageView.snp.makeConstraints { make in | ||
73 | + make.centerY.equalToSuperview() | ||
74 | + make.trailing.equalTo(snp.trailing).offset(-28) | ||
75 | + } | ||
76 | + } | ||
77 | +} | ||
78 | + |
Please
register
or
login
to post a comment