// 初始化 外观
- (void)configAppearance {
NSDictionary *titleDic = @{
NSFontAttributeName:kFDFont_Medium(18),
NSForegroundColorAttributeName: kFDColorRGBHex(0x333333)
};
UIColor *backgroundColor = UIColor.whiteColor;
if (@available(iOS 13.0, *) ) {
UINavigationBarAppearance *navapp = UINavigationBarAppearance.new;
// 导航栏背景色
[navapp configureWithOpaqueBackground];
[navapp setBackgroundColor:backgroundColor];
// 导航栏标题
[navapp setTitleTextAttributes:titleDic];
UINavigationBar.appearance.scrollEdgeAppearance = navapp;
UINavigationBar.appearance.standardAppearance = navapp;
UINavigationBar.appearance.compactAppearance = navapp;
} else {
UINavigationBar *appearance = [UINavigationBar appearance];
// 导航栏背景色
[appearance setTranslucent:NO];
[appearance setBarTintColor:backgroundColor];
// 导航栏标题
[appearance setTitleTextAttributes:titleDic];
}
UIBarButtonItem *itemapp = UIBarButtonItem.appearance;
itemapp.tintColor = kFDColorRGBHex(0x333333);
}
iOS 13 导航栏 适配
最新推荐文章于 2023-07-11 09:23:44 发布