swift ios 8 change font title of section in a tableview -


i change font type , font size of section header in 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 doesn't work. ideas?

swift 3

    override func tableview(_ tableview: uitableview, viewforheaderinsection section: int) -> uiview? {             let headerview = uiview()             headerview.backgroundcolor = uicolor.lightgray              let headerlabel = uilabel(frame: cgrect(x: 30, y: 0, width:                 tableview.bounds.size.width, height: tableview.bounds.size.height))             headerlabel.font = uifont(name: "verdana", size: 20)             headerlabel.textcolor = uicolor.white             headerlabel.text = self.tableview(self.tableview, titleforheaderinsection: section)             headerlabel.sizetofit()             headerview.addsubview(headerlabel)              return headerview         }      override func tableview(_ tableview: uitableview, heightforheaderinsection section: int) -> cgfloat {         return 40     } 

Comments