In my willDisplayHeaderView I have changed color of section header But I want to add an image before section title. Any help? My code for willDisplayHeaderView is
You could design your own header, like you would design a custom cell in a table view. Or you could just add an image like so:
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
var myCustomView: UIImageView
var myImage: UIImage = UIImage(named: "myImageResource")
myCustomView.image = myImage
let header: UITableViewHeaderFooterView = view as UITableViewHeaderFooterView
header.addSubview(myCustomView)
return header
}
Then you can simply add your section title UILabel as another subview.