美文网首页
iOS15踩坑点

iOS15踩坑点

作者: 靠北的北 | 来源:发表于2021-09-29 11:37 被阅读0次
    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;
        }
    

    相关文章

      网友评论

          本文标题:iOS15踩坑点

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