-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyHeader.swift
executable file
·46 lines (36 loc) · 1.14 KB
/
myHeader.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
//
// myHeader.swift
// YumaApp
//
// Created by Yuma Usa on 2018-02-06.
// Copyright © 2018 Yuma Usa. All rights reserved.
//
import UIKit
class MyHeader: UITableViewHeaderFooterView {
@IBOutlet var whole: XibView!
let headerNib = UINib.init(nibName: "MyHeader", bundle: Bundle.main)
//tblItems.register(headerNib, forHeaderFooterViewReuseIdentifier: "MyHeader")
weak var delegate: CustomHeaderDelegate?
@IBOutlet weak var label: UILabel!
var sectionNumber: Int!
var showBack: Bool!
@IBAction func backBtn(_ sender: Any) {
delegate?.didTapButton(in: sectionNumber)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
Bundle.main.loadNibNamed("MyHeader", owner: self, options: nil)
//self.addSubview(self.view)
}
/*
// Only override draw() if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func draw(_ rect: CGRect) {
// Drawing code
}
*/
}
// if you want your header to be able to inform view controller of key events, create protocol
protocol CustomHeaderDelegate: class {
func didTapButton(in section: Int)
}