swift - Changing properties of objects
问题描述
I'm making my own up and facing right now the problem: I found a guide on apple developer web site, but it's out of date and the code they show doesn't work nowadays, I would like to know how is it done right now
I've tried code of apple
//Example from their site. In my case the same but with UILabel
[[UINavigationBar appearance] setBarTintColor:myNavBarBackgroundColor];
I expected to change globally text color, but could not
解决方案
Since you've tagged this question as Swift I suppose you're looking for Swift code. So, code which you've posted is in Objective-C so wherever you find this piece of code in Apple docs, on the top of the page you can find button for switching language to Swift
So, if you're looking for way, how to change barTintColor of UINavigationBar
through the appearance, use this
UINavigationBar.appearance().barTintColor = yourColor