美文网首页
在ios15导航条颜色失效

在ios15导航条颜色失效

作者: 滴滴滴开门 | 来源:发表于2022-01-24 14:55 被阅读0次
    if (@available(iOS 15.0, *)) {
        UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
        appearance.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"]; //背景色
        appearance.shadowColor = UIColor.clearColor; //阴影
        self.navigationController.navigationBar.standardAppearance = appearance;
        self.navigationController.navigationBar.scrollEdgeAppearance = appearance;
    }
    


    AppDelegate - didFinishLaunchingWithOptions新增

    if (@available(iOS 13.0, *)) {
        UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
        appearance.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"]; //背景色
        appearance.shadowColor = UIColor.clearColor; //阴影
        [[UINavigationBar appearance] setStandardAppearance:appearance];
        [[UINavigationBar appearance] setScrollEdgeAppearance:appearance];
    
    }
    

    相关文章

      网友评论

          本文标题:在ios15导航条颜色失效

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