【问题标题】:Header for first tableview section is bigger than the rest第一个 tableview 部分的标题比其他部分大
【发布时间】:2015-08-02 11:44:26
【问题描述】:

我正在制作一个自定义的 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:heightForHeaderInSection:吗?
  • 不,我没有,我会试试的。
  • 我试过了,它有效,谢谢会在 4 分钟内选择你的答案(堆栈交换不会让我立即选择它)

标签: uitableview swift layout


【解决方案1】:

试试这个

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多