我想在我的 Tableview 的 sectionHeader 中显示名称和其他一些简短信息。
有些名称非常大,所以放不下,有没有办法像在标签中那样自动调整 sectionHeader 中的字体大小:
label.adjustsFontSizeToFitWidth = true;
最佳答案
最简单的方法是在 tableView(_:viewForHeaderInSection:)
Apple Docu 讨论:
The table view uses a fixed font style for section header titles. If you want a different font style, return a custom view (for example, a UILabel object) in the delegate method tableView(_:viewForHeaderInSection:) instead.
关于ios - sectionHeader 中的自动调整字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51401926/