iOS 15 UI适配

1. UINavigationBar

  • 在iOS 15中,UINavigationBar默认为透明。在滑动时会有模糊效果。如果想要一直就是模糊效果,可以通过改变scrollEdgeAppearance属性来实现。
if (@available(iOS 15.0, *)) {
        UINavigationBarAppearance *barApp = [UINavigationBarAppearance new];
        barApp.backgroundColor = [[UIColor blueColor] colorWithAlphaComponent:0.5];
        self.navigationController.navigationBar.scrollEdgeAppearance = barApp;
        self.navigationController.navigationBar.standardAppearance = barApp;
    }

2. iOS 15 UITableView sectionHeader下移22像素

iOS 15中 UITableView 新增了一个属性:sectionHeaderTopPadding。此属性会给每一个 section header 增加一个默认高度,当我们使用 UITableViewStylePlain 初始化UITableView 的时候,系统默认给 section header 增高了22像素。

if (@available(iOS 15.0, *)) {
    tableView.sectionHeaderTopPadding = 0;
}
 
posted @   kawerd  阅读(150)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 实操Deepseek接入个人知识库
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
点击右上角即可分享
微信分享提示