AnalysisHeaderViewCell.swift 1.7 KB
//
//  AnalysisHeaderViewCell.swift
//  SwiftWarplyFramework
//
//  Created by Manos Chorianopoulos on 18/7/22.
//

import UIKit

class AnalysisHeaderViewCell: UITableViewCell {

    // attributes
    @IBOutlet weak var itemImage: UIImageView!
    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet weak var emptyLabel: UILabel!
    @IBOutlet weak var emptyLabelHeight: NSLayoutConstraint!
    @IBOutlet weak var emptyLabelTopSpace: NSLayoutConstraint!
    @IBOutlet weak var emptyLabelBottomSpace: NSLayoutConstraint!
    
    // lifecycle
    override func awakeFromNib() {
        super.awakeFromNib()
        
        // image
//        itemImage.image = UIImage(named: "ic_gift_circle_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
        
        // title
//        titleLabel.textColor = UIColor(rgb: 0x435563)
//        titleLabel.text = "Αναλυτικά:"
    }
}

extension AnalysisHeaderViewCell {
    func configureCell(isEmpty: Bool, isMarket: Bool) {
        
        if (isEmpty == true) {
            emptyLabel.isHidden = false
            emptyLabelHeight.constant = 18.5
//            emptyLabelTopSpace.constant = 30.0
            emptyLabelBottomSpace.constant = 10.0
        } else {
            emptyLabel.isHidden = true
            emptyLabelHeight.constant = 0.0
//            emptyLabelTopSpace.constant = 0.0
            emptyLabelBottomSpace.constant = 0.0
        }
        
        if (isMarket == true) {
            itemImage.image = UIImage(named: "ic_history_market_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
        } else {
            itemImage.image = UIImage(named: "ic_gift_history", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
        }
        
    }
}