美文网首页
iOS 15 UITableView SectionHeader

iOS 15 UITableView SectionHeader

作者: 東玖零 | 来源:发表于2021-10-20 18:14 被阅读0次

背景:页面细节优化发现TableView列表Cell的间隙变大了,看起来很不协调,Cell设置上背景颜色,再SectionHeader也设置上背景颜色,发现SectionHeader上方多出来了一块空隙。

WX20211020-180715@2x.png
经过一番各种尝试都无效,最终在搜索出相关文章

附上swift的写法:
1.全局设置

if #available(iOS 15.0, *) {
    UITableView.appearance().sectionHeaderTopPadding = 0
}

2.单个设置

if #available(iOS 15.0, *) {
    _tableView.sectionHeaderTopPadding = 0
}

相关文章

网友评论

      本文标题:iOS 15 UITableView SectionHeader

      本文链接:https://www.haomeiwen.com/subject/wzotaltx.html