iOS 15.0+ push导航栏透明变换

if(@available(ios 15.0,*)){
        UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
        [appearance configureWithOpaqueBackground];
        appearance.backgroundColor = [UIColor whiteColor];
        appearance.shadowColor = [UIColor clearColor];
        self.navigationBar.standardAppearance = appearance;
        self.navigationBar.scrollEdgeAppearance=self.navigationBar.standardAppearance;
    }
    

添加上面这段代码就可以实现去除透明变化的影响.去除导航栏下面的黑线.

appearance.shadowColor = [UIColor clearColor];

你可能感兴趣的:(iOS 15.0+ push导航栏透明变换)