Set appearance of all instances of the class

suggest change

To customize appearance of all instances of a class, access appearance proxy of the desired class. For example:

Set UIButton tint color

Swift:

UIButton.appearance().tintColor = UIColor.greenColor()

Objective-C:

[UIButton appearance].tintColor = [UIColor greenColor];

Set UIButton background color

Swift:

UIButton.appearance().backgroundColor = UIColor.blueColor()

Objective-C:

[UIButton appearance].backgroundColor = [UIColor blueColor];

Set UILabel text color

Swift:

UILabel.appearance().textColor = UIColor.redColor()

Objective-C:

[UILabel appearance].textColor = [UIColor redColor];

Set UILabel background color

Swift:

UILabel.appearance().backgroundColor = UIColor.greenColor()

Objective-C:

[UILabel appearance].backgroundColor = [UIColor greenColor];

Set UINavigationBar tint color

Swift:

UINavigationBar.appearance().tintColor = UIColor.cyanColor()

Objective-C:

[UINavigationBar appearance].tintColor = [UIColor cyanColor];

Set UINavigationBar background color

Swift:

UINavigationBar.appearance().backgroundColor = UIColor.redColor()

Objective-C:

[UINavigationBar appearance].backgroundColor = [UIColor redColor];

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents