swift ios 8 change font title of section in a tableview

前端 未结 11 1602
夕颜
夕颜 2021-01-31 08:29

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, willDi         


        
11条回答
  •  [愿得一人]
    2021-01-31 08:56

    Updated for Swift 3

    func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
    
        let header = view as? UITableViewHeaderFooterView
        header?.textLabel?.font = UIFont(name: "Futura", size: 12) // change it according to ur requirement
        header?.textLabel?.textColor = UIColor.red // change it according to ur requirement
    }
    

提交回复
热议问题