The system is blue by default. But when Tabbaritem's selected icon is changed to Gray, we also want to change the text to Gray. This is the time to use it.
Settitletextattributes "method.
The following method can be found in the parent class "Uibaritem" Class of the "Uitabbaritem" class:
/* Specify the font, text color, and shadow properties for the title in the text attributes dictionary, using the Keys found in NSAttributedString.h.
*/
-(void) Settitletextattributes: (Nullable nsdictionary<nsstring *,ID> *) attributes Forstate :(uicontrolstate) state Ns_available_ios (5_0) ui_appearance_selector;
This method is used to change the color of the text. You can find the Keys in the "NSAttributedString.h" class.
//defaultNsmutabledictionary *attrs =[Nsmutabledictionary dictionary]; Attrs[nsfontattributename]= [Uifont systemfontofsize: A]; Attrs[nsforegroundcolorattributename]=[Uicolor Graycolor]; [Essencevc.tabbaritem settitletextattributes:attrs Forstate:uicontrolstatenormal]; //selectedNsmutabledictionary *attrselected =[Nsmutabledictionary dictionary]; Attrselected[nsfontattributename]= [Uifont systemfontofsize: A]; Attrselected[nsforegroundcolorattributename]=[Uicolor Darkgraycolor]; [Essencevc.tabbaritem settitletextattributes:attrselected forstate:uicontrolstatenormal];
Oc-tabbar the selected text changes color