I have created a UIView on my storyboard and I want to use this view for the header of my UITableView. I have gave an identifier on storyboard for this view and in viewForHeaderInSection class I dequeue this identifier as shown below. However, whenever I reload the table and I found the headerCell is a new instance. It is not reused in this case.
override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerCell = tableView.dequeueReusableCellWithIdentifier("HeaderCell") as! UserHomeHeaderCell
I have tried to register this class on viewDidLoad() method as below:
tableView.registerClass(UserHomeHeaderCell.classForCoder, forCellReuseIdentifier: "HeaderCell")
But all the cell's content which are linked with storyboard are nil. How should I reuse this header?