iOS 导航栏消失


iOS15 导航栏在静止时,设置的图片会透明,以及消失。

解决如下

 if (@available(iOS 13.0, *)) {
                UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
                UIImage *backGroundImage = [UIImage imageNamed:@"home_nav_imgV"];
                backGroundImage = [backGroundImage resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeStretch];
                appearance.backgroundImage = backGroundImage;
                appearance.shadowColor = [UIColor clearColor];
                appearance.shadowImage = [UIImage new];
                self.navigationController.navigationBar.standardAppearance = appearance;
                self.navigationController.navigationBar.scrollEdgeAppearance = self.navigationController.navigationBar.standardAppearance;
            } else {
                UIImage *backGroundImage = [UIImage imageNamed:@"home_nav_imgV"];
                backGroundImage = [backGroundImage resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeStretch];
                [self.navigationController.navigationBar setBackgroundImage:backGroundImage forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
                [self.navigationController.navigationBar setShadowImage:[UIImage new]];
            }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM