41 lines
1.2 KiB
Swift
41 lines
1.2 KiB
Swift
//
|
|
// MenuHeaderTableViewCell.swift
|
|
// Earthquake Network
|
|
//
|
|
// Created by Busi Andrea on 27/07/2020.
|
|
// Copyright © 2020 Earthquake Network. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class MenuHeaderTableViewCell: UITableViewCell {
|
|
|
|
@IBOutlet weak var appVersionLabel: UILabel!
|
|
@IBOutlet weak var appIdLabel: UILabel!
|
|
|
|
// MARK: - View Lifecycle
|
|
|
|
override func awakeFromNib() {
|
|
super.awakeFromNib()
|
|
|
|
// add a gradient for the background
|
|
let gradient = CAGradientLayer()
|
|
let blueColor = UIColor(red: 0.47, green: 0.72, blue: 0.98, alpha: 1.0)
|
|
gradient.frame = bounds
|
|
gradient.colors = [ blueColor.cgColor, UIColor.white.cgColor ]
|
|
layer.insertSublayer(gradient, at: 0)
|
|
}
|
|
|
|
// MARK: - Public
|
|
|
|
func updateUI() {
|
|
if let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String {
|
|
let version = NSLocalizedString("Versione", comment: "etichetta versione app")
|
|
appVersionLabel.text = "\(version): \(appVersion)"
|
|
}
|
|
|
|
let userId = EQNUser.default().user_ID ?? "n.d."
|
|
appIdLabel.text = "ID: \(userId)"
|
|
}
|
|
}
|