Some settings for iOS Tabbar

Source: Internet
Author: User

In fact, iOS Tabbar is very customizable, we do not need to repeat the wheel, the following is the author collects some of the tabbar commonly used settings, I hope to be helpful to everyone.

Set Tabbar selected color

The iOS7 settings are as follows:

[self. Tabbarcontroller. TabBarsetselectedimagetintcolor: [uicolor greencolor]];

iOS8 the following settings:

Self.tabbar.tintcolor=[uicolor Greencolor];


Remove Tabbar Border

At the beginning of the program at Appdelegate:

[[Uitabbar appearance] setshadowimage:[[uiimage Alloc]init]];

[[Uitabbar appearance] setbackgroundimage:[[uiimage Alloc]init]];


Set the Tabbar item original icon with the original selected icon instead of the system auto-fill Color

    Get TabBar in Get want to the 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 the corresponding picture to item item0.selectedimage = [[UIImage imagenamed:@ "Recognize-1"] Imagewithrenderingmode:    Uiimagerenderingmodealwaysoriginal];;         Item0.image = [[UIImage imagenamed:@ "recognize"] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];    Item1.selectedimage = [[UIImage imagenamed:@ "life-1"] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];;         Item1.image = [[UIImage imagenamed:@ "Life"] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];    Item2.selectedimage = [[UIImage imagenamed:@ "edit-1"] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];; Item2.image = [[UIImage imagenamed:@ "edit] Imagewithrenderingmode:uiimagerenderingmodEalwaysoriginal]; Item3.selectedimage = [[UIImage imagenamed:@ "Setting-1"] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal    ];; Item3.image = [[UIImage imagenamed:@ "setting"] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];


Set Tabbar background picture

    UIView *backview = [[UIView alloc] Initwithframe:cgrectmake (0, 0, Main_screen_width,)];    Backview.backgroundcolor = [Uicolor redcolor];    [Self.tabbar Insertsubview:backview atindex:0];    Self.tabBar.opaque = YES;


Some settings for iOS Tabbar

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.