ios - 标题化 UITableViewHeader 标签
问题描述
我有一个分组的 UITableView,我在情节提要中布局,我想将每个部分的标题从大写更改为标题。
最干净的方法是什么?谢谢
解决方案
这会做到:
override func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
guard let header = view as? UITableViewHeaderFooterView else { return }
header.textLabel?.text = header.textLabel?.text?.capitalized
}
推荐阅读
- sql-server - Microsoft Dynamics 365 在线 SQL Server 数据库的日志文件
- java - PCA 因 ND4J 失败:找不到 BLAS?
- matrix - Clojure 生成矩阵
- ruby - Address Sanitizer 与 Ruby Nokogiri 模块
- sql - 数据库设计:一个表中的两行或更多行如何将它们连接在一起?
- java - 为什么浮点值“++”操作与 3.14 不同?
- html - 如何修复导航栏和下拉内容,使其对齐而不重叠?
- python - Django 不会在错误 500 上向管理员发送电子邮件
- django - 如何扩展 django.contrib.auth 视图?
- wit.ai - 如何训练 Wit.ai 学习英语以外的语言?