Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change statusbar color in one view controller using swift?

Tags:

xcode

ios

swift

UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true)

I use this one to change status bar to light in all app. But now I need to change it in just one View Controller back to black. How can I do that?

like image 521
Ivan A Avatar asked Jan 28 '16 12:01

Ivan A


People also ask

How do I change the color of my text bar in swift 5?

Go to Project -> Target , Then set Status Bar Style to Light . It makes status-bar white from the launch screen. Then set View controller-based status bar appearance equal to NO in Info.


1 Answers

Solved:
Swift 3.1

Just using this code in View Controller:

override var preferredStatusBarStyle: UIStatusBarStyle {
    return .lightContent
}
like image 65
reza_khalafi Avatar answered Oct 20 '22 08:10

reza_khalafi