How to Set and use the color and font size of the title and the default TabBar in iOS settings navigation, iostabbar

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.