[英]UITableView Section header color misbehaving
我更改了自定义UITableViewCell
节标题的颜色,并在tableView
滚动时更改了它的alpha值。 有些是透明的,有些则是纯色的。
怎么了?
// Customize HeaderView of Sections
func tableView(tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
// This changes the header background
view.tintColor = UIColor(hue: 0.13, saturation: 0.13, brightness: 0.13, alpha: 1)
// Gets the header view as a UITableViewHeaderFooterView and changes the text colour
var headerView: UITableViewHeaderFooterView = view as! UITableViewHeaderFooterView
headerView.textLabel.textColor = UIColor.whiteColor()
}
我强烈建议您使用以下方法配置标题视图:
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
除了主要配置外观之外,我将将willDisplayHeader...
用于其他目的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.