How to Set and use the color and font size of the title and the default TabBar in iOS settings navigation, iostabbar
Step 1:
// Add a field in info. plist: view controller-base status bar to NO;
// Navigation color
[[UINavigationBar appearance] setBarTintColor: [UIColor XXXX];
[[UITableViewCell appearance] setBackgroundColor: [UIColor XXXX];
// Set the status bar (signal area) to white
[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleDefault];
// The system is transparent by default. You can use the following methods to remove the system effect:
[NavigationController. navigationBar setTranslucent: NO];
// Set the font size and color of the navigation title on the first page as follows:
// Set the color and font size of the default navigation title
Self. navigationController. navigationBar. titleTextAttributes =@{ UITextAttributeTextColor: [UIColor whiteColor], UITextAttributeFont: [UIFont boldSystemFontOfSize: 18]};
Step 2:
// UIImageRenderingModeAlwaysOriginal. The original image style is used to remove the color added by the system.
If ([[UIDevice currentDevice] systemVersion]. floatValue> = 8.0 ){
Self. tabBarItem = [[UITabBarItem alloc] initWithTitle: @ "title" image: [[UIImage imageNamed: @ "Image.png"] imageWithRenderingMode: Custom] selectedImage: [[UIImage imageNamed: @ "ImageS.png"] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal];
} Else {
Self. tabBarController. tabBarItem. title = @ "title ";
If ([[UIDevice currentDevice] systemVersion]. floatValue> = 7.0 ){
[Self. tabBarController. tabBarItem detail: [[UIImage imageNamed: @ "Image.png"] imageWithRenderingMode: Custom] Background: [[UIImage imageNamed: @ "ImageS.png"] imageWithRenderingMode: Custom];
} Else {
[Self. tabBarController. tabBarItem setFinishedSelectedImage: [UIImage imageNamed: @ "Image.png"] withFinishedUnselectedImage: [UIImage imageNamed: @ "ImageS.png"];
}
}
// The tabbar color is used to change the font color.
[Self. tabBarController. tabBar setTintColor: [UIColor XXXX];
Demo address:
Https://github.com/wly314/HappyTravel
Welcome to the discussion.