WalletQuestionnaireBannerTableViewCell.swift
4.6 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
//
// WalletQuestionnaireBannerTableViewCell.swift
// SwiftWarplyFramework
//
// Created by Manos Chorianopoulos on 27/2/24.
//
import UIKit
@objc public class WalletQuestionnaireBannerTableViewCell: UITableViewCell {
@IBOutlet weak var bannerView: UIView!
@IBOutlet weak var bannerIconImage: UIImageView!
@IBOutlet weak var bannerIconImageWidth: NSLayoutConstraint!
@IBOutlet weak var bannerLabel: UILabel!
@IBOutlet weak var bannerLabelLeftSpace: NSLayoutConstraint!
// @IBOutlet weak var bannerArrowImage: UIImageView!
@IBOutlet weak var bannerCenteredView: UIView!
@IBOutlet weak var bannerCenteredIconImage: UIImageView!
@IBOutlet weak var bannerCenteredIconImageWidth: NSLayoutConstraint!
@IBOutlet weak var bannerCenteredLabel: UILabel!
@IBOutlet weak var bannerCenteredLabelLeftSpace: NSLayoutConstraint!
public override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
bannerView.layer.cornerRadius = 12.0
bannerView.layer.borderWidth = 1
bannerView.layer.borderColor = UIColor(red: 0.05, green: 0.65, blue: 0.00, alpha: 1.00).cgColor
// bannerView.layer.borderColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00).cgColor
bannerCenteredView.layer.cornerRadius = 12.0
bannerCenteredView.layer.borderWidth = 1
bannerCenteredView.layer.borderColor = UIColor(red: 0.05, green: 0.65, blue: 0.00, alpha: 1.00).cgColor
// Add shadow
// bannerView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.2).cgColor
// bannerView.layer.shadowOffset = CGSize(width: 0.0, height: 1.0)
// bannerView.layer.shadowOpacity = 1.0
// bannerView.layer.shadowRadius = 1.0
bannerIconImage.image = UIImage(named: "wallet_plus", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
bannerCenteredIconImage.image = UIImage(named: "wallet_plus", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
// bannerArrowImage.image = UIImage(named: "arrow_right_black", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
bannerLabel.font = UIFont(name: "PeridotPE-Bold", size: 12)
bannerCenteredLabel.font = UIFont(name: "PeridotPE-Bold", size: 12)
}
public override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
func configureCell(isCentered: Bool) {
let userTag = swiftApi().getUserTag()
// print("User tag: " + userTag)
if (userTag != "" && userTag != "undefined") {
bannerLabel.text = userTag
bannerLabel.frame.size.width = bannerLabel.intrinsicContentSize.width
bannerIconImage.isHidden = true
bannerIconImageWidth.constant = CGFloat(0.0)
bannerLabelLeftSpace.constant = CGFloat(0.0)
bannerView.frame.size.width = bannerView.intrinsicContentSize.width
bannerCenteredLabel.text = userTag
bannerCenteredLabel.frame.size.width = bannerCenteredLabel.intrinsicContentSize.width
bannerCenteredIconImage.isHidden = true
bannerCenteredIconImageWidth.constant = CGFloat(0.0)
bannerCenteredLabelLeftSpace.constant = CGFloat(0.0)
bannerCenteredView.frame.size.width = bannerLabel.intrinsicContentSize.width
} else {
bannerLabel.text = "Πρόσθεσε τις προτιμήσεις σου"
bannerLabel.frame.size.width = bannerLabel.intrinsicContentSize.width
bannerIconImage.isHidden = false
bannerIconImageWidth.constant = CGFloat(16.0)
bannerLabelLeftSpace.constant = CGFloat(5.0)
bannerView.frame.size.width = bannerView.intrinsicContentSize.width
bannerCenteredLabel.text = "Πρόσθεσε τις προτιμήσεις σου"
bannerCenteredLabel.frame.size.width = bannerCenteredLabel.intrinsicContentSize.width
bannerCenteredIconImage.isHidden = false
bannerCenteredIconImageWidth.constant = CGFloat(16.0)
bannerCenteredLabelLeftSpace.constant = CGFloat(5.0)
bannerCenteredView.frame.size.width = bannerCenteredView.intrinsicContentSize.width
}
if (isCentered) {
bannerView.isHidden = true
bannerCenteredView.isHidden = false
} else {
bannerView.isHidden = false
bannerCenteredView.isHidden = true
}
}
}