Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

swift ios 8 change font title of section in a tableview

I would like to change the font type and font size of a section header in a table view controller.

My code:

func tableView(tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {     let header = view as! UITableViewHeaderFooterView     header.textLabel.textColor = UIColor.blackColor()     header.textLabel.font = UIFont(name: "Futura", size: 38)! } 

But this doesn't work. Any ideas?

like image 956
Ghost108 Avatar asked Jul 13 '15 11:07

Ghost108


Video Answer


1 Answers

override func tableView(tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {     let header = view as! UITableViewHeaderFooterView     header.textLabel?.font = UIFont(name: "Futura", size: 38)!     header.textLabel?.textColor = UIColor.lightGrayColor() } 
like image 181
Atticus Avatar answered Sep 17 '22 19:09

Atticus