i want to change all the UILabel's text color for total app how can i do this .is there any simple way to change label color.
i tried this ,but i want to change write this code in every class
for( UIView *view in [testScroll subviews])
{
if([view isKindOfClass:[UILabel class]])
{
[(UILabel *)view setTextColor:[UIColor whiteColor]];
}
else if([view isKindOfClass:[UIView class]])
}
Do anyone have simple method .
Well if you're targeting iOS 5+ you could do that really easy (inside you appdelegate):
This works because
UILabel
conforms toUIAppearance
protocol, so you could customize any class that conforms to the protocol like this. For more information on this here is a nice tutorial to get you started and here is Apple's docs on the protocolCreate a subclass of the UILabel. You can override the init functions where you can set the text Color you want. Use that subclass throughout your project.
and now jus use your CustomLabel.