I'm basically trying to do what's in this link
How to Implement Custom Table View Section Headers and Footers with Storyboard
In my storyboard, I've embedded static cells in my TableViewController
I selected one of my table view cells and set the identifier as "CustomHeader" (at the storyboard)
and below is a snippet of my code
override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
var headerView:UITableViewCell? = tableView.dequeueReusableCellWithIdentifier("CustomHeader") as? UITableViewCell
if (headerView == nil){
println("errrrrrr")
}
return headerView
}
override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 30
}
However, console keeps printing "errrrrrr" meaning that headerView is nil.
But I think whose identifier is "CustomHeader" cannot be nil because I manually selected a cell and set its identifier as CustomHeader in the storyboard!!
I'm new to iOS so I don't get what the problem is.
Any help is appreciated.
Thanks in advance!