2 // MenuTableViewCell.swift
5 // Created by Pawel Dabrowski on 29/05/2018.
6 // Copyright © 2018 Fundacja Nowoczesna Polska. All rights reserved.
11 class MenuTableViewCell: WLTableViewCell {
13 @IBOutlet weak var titleLabel: UILabel!
14 @IBOutlet weak var iconImageView: UIImageView!
15 @IBOutlet weak var selectedIndicator: UIView!
16 private(set) var menuItem: MenuItem!
18 class func instance(menuItem: MenuItem) -> MenuTableViewCell{
19 let cell = MenuTableViewCell.instance(type: MenuTableViewCell.self)
20 cell.setup(menuItem: menuItem, selected: false)
24 override func awakeFromNib() {
26 backgroundColor = UIColor.clear
27 contentView.backgroundColor = UIColor.clear
30 override func setSelected(_ selected: Bool, animated: Bool) {
31 super.setSelected(selected, animated: animated)
32 selectedIndicator.isHidden = !selected
33 iconImageView.tintColor = menuItem == .premium ? MenuItem.premium.tintColor : (selected ? UIColor.white : Constants.Colors.menuTintColor())
36 func setup(menuItem: MenuItem, selected:Bool) {
37 setSelected(selected, animated: false)
38 self.menuItem = menuItem
39 iconImageView.image = menuItem.image
40 titleLabel.text = menuItem.title
41 let tintColor = menuItem.tintColor
42 titleLabel.textColor = tintColor
45 override func getHeight() -> CGFloat {