Changing the color of UITableView section headers

前端 未结 6 1158
抹茶落季
抹茶落季 2020-12-31 01:47

OK, I know that this has been asked previously, so please forgive me for asking again. It just seems like there has got to be an easier way to do this.

Is there a \

6条回答
  •  礼貌的吻别
    2020-12-31 02:21

    we can change the header background color like this :

    func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int){         
          let tableHeader = view as! UITableViewHeaderFooterView        
          tableHeader.backgroundView?.backgroundColor = UIColor.white     
        }
    

提交回复
热议问题