第一个tableview部分的标题比其他部分更大

时间:2015-05-21 01:25:59

标签: uitableview swift layout

我正在制作自定义的uitableview。但是第一部分的标题比其他标题更大。

以下是代码:

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

}

tableview screen shot

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

试试这个

func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 30.0
    }
相关问题