Settings of iOS Tabbar

Source: Internet
Author: User

Settings of iOS Tabbar

In fact, the customization of iOS Tabbar is very high, and we do not need to duplicate the wheel. Below are some common settings of tabbar collected by the author, I hope to help you.

Set the selected color of tabbar

The iOS7 settings are as follows:

 

[Self. tabBarController. tabBarsetSelectedImageTintColor: [UIColor greenColor];

The following settings are available in ios8:

Self. tabBar. tintColor = [UIColor greenColor];


Eliminate the tabbar border

 

At the startup of the appdelegate program:

[[UITabBar appearance] setShadowImage: [[UIImage alloc] init];

[[UITabBar appearance] setBackgroundImage: [[UIImage alloc] init];


Set the original and original tabbar item icons instead of the automatically filled color.

 

// Get the TabBar and get the expected item UITabBar * tabBar = _ tabBarController. tabBar; UITabBarItem * item0 = [tabBar. items objectAtIndex: 0]; UITabBarItem * item1 = [tabBar. items objectAtIndex: 1]; UITabBarItem * item2 = [tabBar. items objectAtIndex: 2]; UITabBarItem * item3 = [tabBar. items objectAtIndex: 3]; // set item0.selectedImage = [[UIImage imageNamed: @ "recognize-1"] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal] for the item; item0.image = [[UIImage imageNamed: @ "recognize"] imageWithRenderingMode: Batch]; item1.selectedImage = [[UIImage imageNamed: @ "life-1"] imageWithRenderingMode: Batch]; item1.image = [[UIImage imageNamed: @ "life"] imageWithRenderingMode: queue]; item2.selectedImage = [[UIImage imageNamed: @ "edit-1"] imageWithRenderingMode: queue]; item2.image = [[UIImage imageNamed: @ "edit"] imageWithRenderingMode: Batch]; item3.selectedImage = [[UIImage imageNamed: @ "setting-1"] imageWithRenderingMode: Batch]; item3.image = [[UIImage imageNamed: @ "setting"] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal];


 

Set tabbar background image

 

    UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, Main_Screen_Width, 49)];    backView.backgroundColor = [UIColor redColor];    [self.tabBar insertSubview:backView atIndex:0];    self.tabBar.opaque = YES;


 

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.