NavigationBar
原方式self.navigationBar.barTintColor = [UIColor blackColor];
iOS15之后:
if (@available(iOS 15.0, *)) {
UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
[appearance configureWithOpaqueBackground];
appearance.backgroundColor = [UIColor blackColor];
nav.navigationBar.standardAppearance = appearance;
nav.navigationBar.scrollEdgeAppearance = nav.navigationBar.standardAppearance;
}
tabBar
原方式self.tabBar.barTintColor = [UIColor darkGrayColor];
iOS15之后:
if (@available(iOS 15.0, *)) {
UITabBarAppearance *appearance = [UITabBarAppearance new];
[appearance configureWithOpaqueBackground];
appearance.backgroundColor = [UIColor darkGrayColor];
self.tabBar.standardAppearance = appearance;
self.tabBar.scrollEdgeAppearance = appearance;
}
UIToolbar
同tabBar
UITableView
新增了属性 sectionHeaderTopPadding,会给每一个section 的 header 增加一个默认高度。
iOS15之后:
//页面内
if (@available(iOS 15.0, *)) {
self.tableView.sectionHeaderTopPadding = 0;
}
//全局appdelegate
if (@available(iOS 15.0, *)) {
[UITableView appearance].sectionHeaderTopPadding = 0;
}