我正在尝试更改 Grouped
tabledView 中的 headerView 颜色。但是,第二个 header 中似乎有一种奇怪的行为。哪里没有填写完整的标题?这是怎么来的?
override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
var headerView = UIView(frame: CGRectMake(0, 0, self.view.frame.width, 44))
headerView.backgroundColor = UIColor.redColor()
return headerView
}
override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 44
}
最佳答案
分组的表格 View 有表格部分的页脚。您看到部分页脚的灰色。在 - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
方法中返回 0 或 CGFLOAT_MIN
以隐藏页脚。我认为存在 0 不起作用的情况,您必须执行 CGFLOAT_MIN
但如果 0 不起作用,请尝试两者。
下面是快速示例
override func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { return CGFLOAT_MIN; }
关于ios - 更改标题 View 的背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31974487/