dev gr
dev gr

Reputation: 2431

iOS:Is it possible to change appearance of a UI element back to default appearance?

I am setting appearance of UIBarButtonItem using -appearance method. How can I change it back to iOS default appearance? Here I am changing appearance of UIBarButtonItem:

   NSDictionary *textAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                [UIColor colorWithHex:0x3A4047], 
                                UITextAttributeTextColor, 
                                [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.0], 
                                UITextAttributeTextShadowColor, 
                                [UIFont fontWithName:@"Helvetica-Bold" size:13.0], 
                                UITextAttributeFont, 
                                nil];

 [[UIBarButtonItem appearance] setTitleTextAttributes:textAttributes                                                
                                            forState:UIControlStateNormal];

Now at some point can I revert all that appearance proxies that I have applied to default proxies?

Upvotes: 1

Views: 273

Answers (2)

oxigen
oxigen

Reputation: 6263

 [[UIBarButtonItem appearance] setTitleTextAttributes:nil
                                                forState:UIControlStateNormal];

Upvotes: 1

Wyetro
Wyetro

Reputation: 8588

Create an NSDictionary with all of the default attributes before you create *textAttributes. Then when you want to make it default set the attributes to the other NSDictionary.

Upvotes: 1

Related Questions