1、UITableView
在appdelegate方法didFinishLaunchingWithOptions添加代码:
if (@available(iOS 15.0,*))
{
[UITableView appearance].sectionHeaderTopPadding = 0;
}
2、UINavigation
在BaseVC中添加:
if (@available(iOS 13.0,*))
{
UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
appearance.backgroundColor = [UIColor whiteColor];
appearance.shadowColor = [UIColor whiteColor];
appearance.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor jk_colorWithHexString:@"#333333"],
NSFontAttributeName:[UIFont fontWithName:@"PingFangSC-Medium" size:18]};
self.navigationController.navigationBar.standardAppearance = appearance;
self.navigationController.navigationBar.scrollEdgeAppearance = appearance;
}
else
{
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor jk_colorWithHexString:@"#333333"],
NSFontAttributeName:[UIFont fontWithName:@"PingFangSC-Medium" size:18]};
[self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.shadowImage = [[UIImage alloc] init];
self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
}
3、UITabBar
if (@available(iOS 15.0,*))
{
UITabBarAppearance *appearance = [[UITabBarAppearance alloc] init];
appearance.shadowColor = [UIColor clearColor];
appearance.backgroundColor = [UIColor whiteColor];
[UITabBar appearance].scrollEdgeAppearance = appearance;
[UITabBar appearance].standardAppearance = appearance;
}
网友评论