Showing
3 changed files
with
46 additions
and
0 deletions
No preview for this file type
No preview for this file type
... | @@ -164,6 +164,52 @@ import SwiftEventBus | ... | @@ -164,6 +164,52 @@ import SwiftEventBus |
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | + public override func viewWillAppear(_ animated: Bool) { | ||
168 | + super.viewWillAppear(animated) | ||
169 | + | ||
170 | + let userTag = swiftApi().getUserTag() | ||
171 | + if (questionnaireButton.currentTitle != userTag) { | ||
172 | + if (userTag != "") { | ||
173 | + questionnaireButton.setTitle(userTag, for: .normal) | ||
174 | + questionnaireButton.titleLabel?.font = UIFont.systemFont(ofSize: 13, weight: .semibold) | ||
175 | + questionnaireButton.setTitleColor(.white, for: .normal) | ||
176 | + // questionnaireButton.sizeToFit() | ||
177 | + questionnaireButton.frame = CGRect(x: 0.0, y: 0.0, width: questionnaireButton.intrinsicContentSize.width, height: questionnaireButton.intrinsicContentSize.height) | ||
178 | + questionnaireButton.applyGradient(colours: [UIColor(red: 0.40, green: 0.77, blue: 0.28, alpha: 1.00), UIColor(red: 0.10, green: 0.66, blue: 0.72, alpha: 1.00)], gradient: GradientOrientation.horizontal, cornerRadius: 7.0) | ||
179 | + // Shadow Color | ||
180 | + questionnaireButton.layer.shadowColor = UIColor(red: 0.33, green: 0.38, blue: 0.43, alpha: 1.00).cgColor | ||
181 | + questionnaireButton.layer.shadowOffset = CGSize(width: 0.0, height: 2.0) | ||
182 | + questionnaireButton.layer.shadowOpacity = 1.0 | ||
183 | + questionnaireButton.layer.shadowRadius = 0.0 | ||
184 | + questionnaireButton.layer.masksToBounds = false | ||
185 | + } else { | ||
186 | + questionnaireButton.setTitle("+Προτιμήσεις", for: .normal) | ||
187 | + questionnaireButton.titleLabel?.font = UIFont.systemFont(ofSize: 13, weight: .semibold) | ||
188 | + questionnaireButton.setTitleColor(UIColor(red: 0.31, green: 0.62, blue: 0.18, alpha: 1.00), for: .normal) | ||
189 | + questionnaireButton.backgroundColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00) | ||
190 | + questionnaireButton.frame = CGRect(x: 0.0, y: 0.0, width: questionnaireButton.intrinsicContentSize.width, height: questionnaireButton.intrinsicContentSize.height) | ||
191 | + } | ||
192 | + questionnaireButton.layer.cornerRadius = 7.0 | ||
193 | + } | ||
194 | + } | ||
195 | + | ||
196 | + public override func viewDidLayoutSubviews() { | ||
197 | + super.viewDidLayoutSubviews() | ||
198 | + | ||
199 | + if let headerView = tableView.tableHeaderView { | ||
200 | + | ||
201 | + let height = headerView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height | ||
202 | + var headerFrame = headerView.frame | ||
203 | + | ||
204 | + //Comparison necessary to avoid infinite loop | ||
205 | + if height != headerFrame.size.height { | ||
206 | + headerFrame.size.height = height | ||
207 | + headerView.frame = headerFrame | ||
208 | + tableView.tableHeaderView = headerView | ||
209 | + } | ||
210 | + } | ||
211 | + } | ||
212 | + | ||
167 | // MARK: - Actions | 213 | // MARK: - Actions |
168 | @IBAction func qustionnaireButtonAction(_ sender: Any) { | 214 | @IBAction func qustionnaireButtonAction(_ sender: Any) { |
169 | swiftApi().openQuestionnaire(self); | 215 | swiftApi().openQuestionnaire(self); | ... | ... |
-
Please register or login to post a comment