【发布时间】:2019-09-23 01:54:33
【问题描述】:
我有一个应用程序在更新到 IOS 13 之前一直正常显示。
在旧版本的应用程序(iOS 13 之前)中,标题文本颜色显示正确。见下文。
现在标题是这样显示的:
我没有改变任何东西,所以我认为苹果方面发生了一些变化。 这就是我设置标题文本颜色的方式:
func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
let header = view as! UITableViewHeaderFooterView
header.textLabel?.textColor = Styles.greyColor()
header.backgroundView?.backgroundColor = Styles.mainColor()
header.textLabel?.font = UIFont.systemFont(ofSize: 13, weight: UIFont.Weight.light)
}
它要求的颜色是这样创建的:
static func greyColor() -> UIColor{
return uicolorFromHex(0x9B9B9B)
}
static func mainColor() -> UIColor {
// blue background
//return uicolorFromHex(0x222C45)
return uicolorFromHex(0x1B2337)
}
这可能已经讨论过,但我似乎找不到任何关于它的最新帖子。
【问题讨论】:
-
在 UITableViewHeaderFooterView 的摘要下它说:“您还可以将可选的背景视图分配给背景视图属性。”这不是我想要做的吗?
-
你可以试试
header.backgroundView?.backgroundColor = .clear -
同样的结果,谢谢你的建议。
-
我可以通过添加解决这个问题:header.contentView.backgroundColor = Styles.mainColor()
标签: ios swift uitableview