Rutger Huijsmans
Rutger Huijsmans

Reputation: 2408

Hiding the statusbar iOS

I'm trying to hide the statusbar on the landingpage of my app only. I figured this is the right function and it does get executed, however the status bar still remains there

override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(animated)
    FBSDKLoginManager().logOut()

    self.prefersStatusBarHidden()
}

override func prefersStatusBarHidden() -> Bool {
    return true
}

What am I doing wrong?

Upvotes: 0

Views: 500

Answers (2)

Wolverine
Wolverine

Reputation: 4329

Try this.

Add below entries in info.plist

View controller-based status bar appearance -> YES

Status bar is initially hidden -> YES

enter image description here

And In ViewControllers, In which you want to hide the StatusBar, Write below method.

override var prefersStatusBarHidden: Bool {  
    return true  
}  

Upvotes: 2

iOS Developer
iOS Developer

Reputation: 437

Set value "No" for key "View controller-based status bar appearance" in plist file

and No need to call "self.prefersStatusBarHidden()" manually so remove it from viewDidAppear

Upvotes: 0

Related Questions