Changing Font Size For UITableView Section Headers

前端 未结 11 772
借酒劲吻你
借酒劲吻你 2020-12-12 09:28

Can someone please instruct me on the easiest way to change the font size for the text in a UITableView section header?

I have the section titles implemented using t

11条回答
  •  既然无缘
    2020-12-12 10:04

    Swift 3:

    Simplest way to adjust only size:

    func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
    
        let header = view as! UITableViewHeaderFooterView
    
        if let textlabel = header.textLabel {
            textlabel.font = textlabel.font.withSize(15)
        }
    }
    

提交回复
热议问题