SettingTableViewCell.swift
1.7 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
//
// settingTableViewCell.swift
// browser
//
// Created by Artem Talko on 26.09.2023.
//
import UIKit
final class SettingTableViewCell: UITableViewCell {
let settingTableViewLabel: UILabel = {
let obj = UILabel()
obj.font = FontConstants.semiboldFont_17
obj.textColor = ColorConstants.lightGray
obj.textAlignment = .center
obj.backgroundColor = ColorConstants.buttonsBackgroundColor
obj.layer.cornerRadius = 10
obj.layer.masksToBounds = true
return obj
}()
let gradientLayer = CAGradientLayer()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setup()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setup() {
contentView.addSubview(settingTableViewLabel)
setupConstraints()
}
override func layoutSubviews() {
super.layoutSubviews()
gradientLayer.frame = self.bounds
}
private func setupConstraints() {
settingTableViewLabel.snp.makeConstraints { make in
make.top.equalToSuperview().inset(10)
make.bottom.equalToSuperview().inset(10)
make.leading.trailing.equalToSuperview().inset(10)
}
}
}
//MARK: Gradient
extension SettingTableViewCell {
private func gradientSetup() {
self.layer.insertSublayer(gradientLayer, at: 0)
gradientLayer.colors = [UIColor(red: 0.349, green: 0.565, blue: 1, alpha: 1).cgColor, UIColor(red: 0.349, green: 0.565, blue: 1, alpha: 0.7).cgColor]
gradientLayer.locations = [0.0, 1.0]
}
}