Hiding the Status Bar

When you’re being hypnotized, you probably don’t want to see the time or your remaining battery charge – these things cause anxiety. So, you’re going to hide the status bar before you make the window visible. In HypnosisterAppDelegate.m, add a line near the end of application:​didFinishLaunchingWithOptions:.

 ​ ​ ​ ​[​s​c​r​o​l​l​V​i​e​w​ ​a​d​d​S​u​b​v​i​e​w​:​v​i​e​w​]​;​

 ​ ​ ​ ​[​s​c​r​o​l​l​V​i​e​w​ ​r​e​l​e​a​s​e​]​;​


 ​ ​ ​ ​[​[​U​I​A​p​p​l​i​c​a​t​i​o​n​ ​s​h​a​r​e​d​A​p​p​l​i​c​a​t​i​o​n​]​ ​s​e​t​S​t​a​t​u​s​B​a​r​H​i​d​d​e​n​:​Y​E​S​
 ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​w​i​t​h​A​n​i​m​a​t​i​o​n​:​U​I​S​t​a​t​u​s​B​a​r​A​n​i​m​a​t​i​o​n​F​a​d​e​]​;​


 ​ ​ ​ ​[​[​s​e​l​f​ ​w​i​n​d​o​w​]​ ​m​a​k​e​K​e​y​A​n​d​V​i​s​i​b​l​e​]​;​
 ​ ​ ​ ​r​e​t​u​r​n​ ​Y​E​S​;​
}​

Build and run the application again. Notice the status bar fading out after the application launches. You can also hide the status bar before your application appears on the screen by adding a new key-value pair to the application’s info property list. To do this, select the project from the project navigator. Then select the Hypnosister target and the Info pane in the editor area (Figure 6.6). This pane is an editor for the Info.plist file that is a part of every iOS application. (You could select the Hypnosister-Info.plist file from the project navigator, but this interface shows the key-value pairs more clearly.)

Figure 6.6  Info property list with hidden status bar

Info property list with hidden status bar

Select the last row and click the + icon next to the key name. A new row will appear, and a pop-up menu will open in the Key column. Choose Status bar is initially hidden from this list and hit return. In the Value column, change the value to YES. Now the status bar will be hidden as soon as you launch the application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.136.84