I'm trying to use UIAppearance to configure the style of my Apps. It works perfectly with the UI components like UIView or UIButton, but it doesn't with UIViewControllers. I would like to do something like:
let appearance = FirstViewController.appearance()
Is there a way to use UIAppearance with ViewControllers?
You don´t set the background color in a
viewController
you do set it on theviewControllers
view
. If you useUIView.appearance().backgroundColor
you will change the background of all views.So the answer to your question is no you can´t use
UIAppearance
to change theviewControllers
background color.What you could do is the following:
Then use the inspector in your Storyboard to change
UIViewController
toFirstViewController
.