Tip: Why do I need to encapsulate the content as nsdictionary when I set a state of the text? This is because the font is associated with a series of attributes, such as font style font color, and so on.
To set the style of a multi-state code, such as a picture, the following is a common other control settings multi-state is generally also at the beginning of the method name set (with Statexxx end), if there is only one state, then the direct use of the point (.) Syntax settings.
#pragma handling Font Click Effect-(void) Dealwithitemfont: (Uitabbaritem *) messageitem{nsmutabledictionary *dic=[nsmutabledictionary Dictionary]; [dic Setvalue:[uicolor Graycolor] forkey:nsforegroundcolorattributename]; [Messageitem settitletextattributes:dic Forstate:uicontrolstatenormal]; Nsmutabledictionary *hightlinedic=[nsmutabledictionary Dictionary]; [Hightlinedic Setvalue:[uicolor Orangecolor] forkey:nsforegroundcolorattributename]; [Messageitem settitletextattributes:hightlinedic forstate:uicontrolstatehighlighted];} #pragma processing Picture Click Effect-(Uitabbaritem *) Dealwithitemimage: (NSString *) normalimagestr selectedimagestr: (NSString *) selectedimagestr{UIImage *normalimage=[uiimage Imagenamed:normalimagestr]; UIImage *selectedimage=[uiimage IMAGENAMED:SELECTEDIMAGESTR]; Selectedimage=[selectedimage Imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]; Uitabbaritem *messageitem=[[uitabbaritem alloc] init]; [Messageitem Setimage:normalimage]; [Messageitem SetSelEctedimage:selectedimage]; return Messageitem;}
Ios-uibarbuttonitem Picture Text Click Effect