iOS change Tabbar picture rendering-Don't let Tabbat have blue rendering and modify text

Source: Internet
Author: User

The way a code implementation of this to write a lot of code, each controller to write UIImage *image=[uiimage imagenamed:@ "Tabbar_friendtrends_click_icon"];//do not let TabBar bottom have render key    Code Image=[image imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]; Vc01.tabbaritem.selectedimage=image; Change text style, size, color nsmutabledictionary *atts=[nsmutabledictionary dictionary];//change text size below Tabbar atts[nsfontattributename     ]=[uifont systemfontofsize:12];//Change the text color Atts[nsforegroundcolorattributename]=[uicolor DarkGrayColor]; Nsmutabledictionary *selectedatts=[nsmutabledictionary Dictionary];
Selectedatts[nsfontattributename]=[uifont Systemfontofsize:12];
Selectedatts[nsforegroundcolorattributename]=[uicolor Greencolor];  [Vc01.tabbaritem Settitletextattributes:selectedatts forstate:uicontrolstateselected];    Mode two changes in the Assets.xcassets folder after the change without code and within all controllers will be acting to the specific operation appearance properties//through appearance unified set all the Uitabbaritem text attributes// The following method with Ui_appearance_selector, can be set through appearance consent settings such as Uitabbaritem text attribute case;
Nsmutabledictionary *atts=[nsmutabledictionary Dictionary];
Atts[nsfontattributename]=[uifont Systemfontofsize:12];
Atts[nsforegroundcolorattributename]=[uicolor Graycolor];

Nsmutabledictionary *selectedatts=[nsmutabledictionary Dictionary];
Selectedatts[nsfontattributename]=atts[nsfontattributename]; Selectedatts[nsforegroundcolorattributename]=[uicolor darkgraycolor];//Here just change, all the text is changed Uitabbaritem *item=[ Uitabbaritem appearance];
[item Settitletextattributes:atts Forstate:uicontrolstatenormal];
[item Settitletextattributes:selectedatts forstate:uicontrolstateselected];

Adding a child controller
Uiviewcontroller *vc01=[[uiviewcontroller Alloc]init];
Vc01.view.backgroundcolor=[uicolor Redcolor];
[Email protected] "essence";
Vc01.tabbaritem.image=[uiimage imagenamed:@ "Tabbar_essence_icon"];
UIImage *image=[uiimage imagenamed:@ "Tabbar_friendtrends_click_icon"];
Do not let Tabbar bottom has the rendering key code Image=[image imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]; vc01.tabbaritem.selectedimage=image;//Add the controller to the uitabbarcontroller inside [self addchildviewcontroller:vc01];
Uiviewcontroller *vc02=[[uiviewcontroller Alloc]init];
[Email protected] "new posts";
Vc02.tabbaritem.image=[uiimage imagenamed:@ "Tabbar_new_click_icon"];
Vc02.tabbaritem.selectedimage=[uiimage imagenamed:@ "Tabbar_new_click_icon"];
Vc02.view.backgroundcolor=[uicolor Cyancolor];
[Self ADDCHILDVIEWCONTROLLER:VC02];

Uiviewcontroller *vc03=[[uiviewcontroller Alloc]init];
Vc03.view.backgroundcolor=[uicolor Bluecolor];
[Email protected] "attention";
Vc03.tabbaritem.image=[uiimage imagenamed:@ "Tabbar_friendtrends_icon"];
Vc03.tabbaritem.selectedimage=[uiimage imagenamed:@ "Tabbar_friendtrends_click_icon"];
[Self addchildviewcontroller:vc03];

Uiviewcontroller *vc04=[[uiviewcontroller Alloc]init];
[Email protected] "I";
Vc04.tabbaritem.image=[uiimage imagenamed:@ "Tabbar_me_icon"];
Vc04.tabbaritem.selectedimage=[uiimage imagenamed:@ "Tabbar_me_click_icon"];
Vc04.view.backgroundcolor=[uicolor Yellowcolor]; [Self ADDCHILDVIEWCONTROLLER:VC04];

iOS change Tabbar picture rendering-Don't let Tabbat have blue rendering and modify text

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.