iOS15 navigation bar adaptation problem

if (@available(iOS 15.0,*) ) {

        UINavigationBarAppearance *apperance = [[UINavigationBarAppearance alloc]init];

        [apperance configureWithOpaqueBackground];// reset the background and shadow color

        apperance.backgroundColor = [UIColor whiteColor];

        apperance.backgroundEffect = nil;

        // Remove the shadow of the navigation bar (if clear is not set, there will be a shadow line under the navigation bar)

       apperance.shadowColor =  [UIColor clearColor];

        [apperance setShadowImage:[UIImage qmui_imageWithColor:[UIColor clearColor]]];

        [apperance setTitleTextAttributes:textAttributes];

        [[UINavigationBar appearance]setStandardAppearance:appearance];

       [[UINavigationBar appearance]setScrollEdgeAppearance:apperance];

    }else{

       

        [[UINavigationBar appearance] setTitleTextAttributes:textAttributes];

        [[UINavigationBar appearance] setBarTintColor:[UIColor whiteColor]];

        [[UINavigationBar appearance] setShadowImage:[UIImage new]];

       

    }

    [[UINavigationBar appearance] setTranslucent:NO];

Guess you like

Origin blog.csdn.net/ForeverMyheart/article/details/121541904