ios 15导航栏适配

if (@available(iOS 15.0, *)){
        UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
        [appearance configureWithOpaqueBackground] ;
        UINavigationBar.appearance.standardAppearance = appearance ;
        UINavigationBar.appearance.compactAppearance = appearance ;
        UINavigationBar.appearance.scrollEdgeAppearance =appearance ;
        appearance.shadowColor = kColor_Controller ;
        appearance.backgroundColor = kColor_Controller ;
    }
//ios15 的适配,右划时,可能会有半透明的效果,我们配合下面的方法,
// 防止push时有阴影动画的bug
    [self.navigationBar setBackgroundImage:[UIImage createImageWithColor:RGB_COLOR(246, 246, 246)] forBarMetrics:UIBarMetricsDefault];

暂无评论

相关推荐

获取UIImage的尺寸

int contentWid = self.view.width ; unsigned long width = CGImageGetWidth(image.CGImage) ; unsigned long height …

微信扫一扫,分享到朋友圈

ios 15导航栏适配