Author Topic: How do I hide the status bar in my app?  (Read 3320 times)

kjmcneish

  • Administrator
  • *****
  • Posts: 719
    • View Profile
How do I hide the status bar in my app?
« on: March 20, 2014, 10:41:46 AM »
To hide the status bar for ALL scenes in your app, you need to add two values to your app's .plist file.

  • In the Project Navigator, expand the Supporting Files node.
  • Click on the project's .plist file to select it. This displays the plist editor in the center pane of the Xcode window.
  • Click the Information Property List item in the first row.
  • Click the + sign that appears to the right. This adds a new item to the .plist file and displays a popup list.
  • Begin typing the word "Status" and then select Status bar is initially hidden from the list of choices. Afterwards, go the Value column and select YES.
  • Now add a second new item to the list by clicking the + sign.
  • Begin typing the word "View controller" and then select View controller-based status bar appearance from the list. Afterwards, go to the Value column and select NO.

To hide the status bar for a SINGLE scene, add the following method to the scene's view controller:

In Swift:
Code: [Select]
override func prefersStatusBarHidden() -> Bool {
        return true
}

In Objective-C
Code: [Select]
- (BOOL)prefersStatusBarHidden
{
    return YES;
}

All the best!
Kevin
Author of "Learn to Code in Swift": https://itunes.apple.com/us/book/learn-to-code-in-swift/id942956811?mt=11
« Last Edit: July 17, 2015, 04:13:12 PM by kjmcneish »