iosobjective-cstatusbarnsnotificationcenterios7-statusbar

Show status bar AND prompt notification drop down


In iOS if you vertically swipe from off the screen onto the screen you will get the notification screen to drop down.

If you set your status bar to hidden (full screen app) then swipe down you get a prompt drop down "tab", which is so nice! (See screenshot below)

Is there anyway to show the status bar so the user can see the time and their service and battery percentage and everything, and then we ALSO have the prompt drop down "tab" display instead of it just automatically sliding down the entire notifications center?

enter image description here


Solution

  • In appDelegate you need to add a second UIWindow (property STRONG retain) that is the full size of your app with a clear background.

    SET THE UIWINDOWS LEVEL TO: setWindowLevel:UIWindowLevelStatusBar+1.0f

    Then you need to add a second VC and set it as the subview for the second UIWindow.

    in that VC.m you do touchesBegan and if the location.y is in the area of the status bar's height times 2 (height*2 because you can pull notifications down from a little lower than the status bar it turns out) then you set the status bar to hidden and call prefersStatusBarHidden YES and setNeedsStatusBarAppearanceUpdate

    *(Note you must create the new UIWindow and VC or else you won't be able to detect touchesBegan in the status bar location).

    Then once touchesEnded or touchesMoved below that region you can make the status bar visible again.

    This flashes the status bar for a split second and causes the triangles to appear.

    Now move your whole app functionality into the second VC




    Proof is in the pudding:enter image description here