-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHeaderCell.swift
47 lines (35 loc) · 1.4 KB
/
HeaderCell.swift
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
//
// HeaderCell.swift
// TeeVee
//
// Created by Jerry on 4/2/16.
// Copyright © 2016 SmartStream. All rights reserved.
//
import UIKit
protocol HeaderCellDelegate: class {
func headerCell(sender: HeaderCell, didTapAddChannel tapped: Bool)
func headerCell(sender: HeaderCell, didTapCheckChannel tapped: Bool, withButtonTitle title: String)
}
class HeaderCell: UITableViewCell {
@IBOutlet weak var checkChannelButton: UIButton!
@IBOutlet weak var addChannelImageView: UIImageView!
weak var delegate: HeaderCellDelegate?
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
backgroundColor = Theme.Colors.DarkBackgroundColor.color
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(imageTapped))
addChannelImageView.addGestureRecognizer(tapGesture)
checkChannelButton.titleLabel?.textColor = Theme.Colors.HighlightColor.color
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
func imageTapped() {
delegate?.headerCell(self, didTapAddChannel: true)
}
@IBAction func onCheckChannelTapped(sender: UIButton) {
delegate?.headerCell(self, didTapCheckChannel: true, withButtonTitle: sender.currentTitle!)
}
}