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
Here it is how we can add custom header in UITableView
.
func tableView(tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
let header: UITableViewHeaderFooterView = view as UITableViewHeaderFooterView
let imageViewGame = UIImageView(frame: CGRectMake(5, 8, 40, 40));
let image = UIImage(named: "Games.png");
imageViewGame.image = image;
header.contentView.addSubview(imageViewGame)
}