I want to change the background color of all the UIViewController
views. I have several UIViewController
classes in my project and i want to set the same background of all views once using UIAppearence
.
I tried the following code:
[[UIView appearance] setBackgroundColor:
[UIColor colorWithPatternImage:[UIImage imageNamed:@"BackgroundImage"]]];
but it change the background color of every UIView including (UIButton
, UIView
subclasses and UILabels
etc.)
Is there any way to handle this situation, so that i can only change the background color of UIViewController
views? I googles a lot but i didn't find any relevent solution.
Any help would be highly appreciated.
Thanks..
Well I think the best is to subclass UIViewController and in viewDidLoad set the backgroundColor. But if you want to use UIAppearance you can do something like this :