Define the global appearance of a view using the Apperance protocol

Source: Internet
Author: User

Suppose you want to define a global bkcolor for the background color

[Email protected] (Nonatomic,strong) Uicolor *bkcolor Ui_appearance_selector;

2. Define the default background color BKCOLR = Redcolor in the following method;

+ (void) initialize{

[CustomView appearance].bkcolor = [Uicolor Redcolor];

}

3. Set the backgroundcolor in the Set method;

-(void) SetBkColor: (Uicolor *) bkcolor{

_bkcolor = Bkcolor;

Self.backgroundcolor = Bkcolor;

}

4: You can use it to set a global property of the view.

[[CustomView appearance] Setbkcolor:[uicolor Yellowcolor]];

Define the global appearance of a view using the Apperance protocol

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.