Boon
Boon

Reputation: 41510

Set direct view background color of view controller using UIAppearance

How do I set direct view background color of for a view controller in my app using UIAppearance without affecting all of its subviews? It seems like iOS 7 is forcing all bar button items to assume the blue color?

Upvotes: 1

Views: 441

Answers (1)

SilenceDogood
SilenceDogood

Reputation: 71

Unfortunately, you can't accomplish this using the appearance proxy. However, one solution if you are using swift and loading your view controllers from storyboards or nibs is to extend UIViewController and override awakeFromNib like so:

extension UIViewController {

    open override func awakeFromNib() {
        super.awakeFromNib()

        view.backgroundColor = UIColor.blue
    }
}

Upvotes: 1

Related Questions