状态栏使用图片
NSDictionary *dict = @{
NSForegroundColorAttributeName : [UIColor whiteColor],
NSFontAttributeName:[UIFont boldSystemFontOfSize:17]
};
if (@available(iOS 15.0, *)) {
UINavigationBarAppearance *appperance = [[UINavigationBarAppearance alloc]init];
//添加背景色
appperance.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"navbar"]];
appperance.shadowImage = [[UIImage alloc]init];
appperance.shadowColor = nil;
//设置字体颜色大小
[appperance setTitleTextAttributes:dict];
self.navigationController.navigationBar.standardAppearance = appperance;
self.navigationController.navigationBar.scrollEdgeAppearance = appperance;
}else{
UINavigationBar *navBar = [UINavigationBar appearance];
[navBar setBackgroundImage:[UIImage imageNamed:@"navbar"] forBarMetrics:UIBarMetricsDefault];
[navBar setTitleTextAttributes:dict];
}
网友评论