Header 第一个 tableview 部分比其余部分大
Header for first tableview section is bigger than the rest
我正在制作自定义 uitableview。但是,第一部分的 header 比其他部分大。
代码如下:
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
var header = UIView(frame: CGRectMake(0, 0, tableView.bounds.width, 30))
header.backgroundColor = UIColor(red: 223/255.0, green: 170/255.0, blue: 128/255.0, alpha: 1.0)
return header
}
我该如何解决这个问题?
试试这个
func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 30.0
}
我正在制作自定义 uitableview。但是,第一部分的 header 比其他部分大。
代码如下:
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
var header = UIView(frame: CGRectMake(0, 0, tableView.bounds.width, 30))
header.backgroundColor = UIColor(red: 223/255.0, green: 170/255.0, blue: 128/255.0, alpha: 1.0)
return header
}
我该如何解决这个问题?
试试这个
func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 30.0
}