Ios-uibarbuttonitem Picture Text Click Effect

Source: Internet
Author: User

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

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.