Reputation: 17892
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?
Upvotes: 2
Views: 1141
Reputation: 17892
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:
Upvotes: 0
Reputation: 2417
I believe there is no direct mechanism, but a trick can be applied to achieve this. But again this won't give the exact solution what you are expecting here. But let me share my thoughts.
Implement the touchBegan method in a UIViewController subclass and Capture the starting point of touch event.
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
UITouch *touch = [touches anyObject];
CGPoint startPoint = [touch locationInView:self.view];
Then you can compare the y coordinate value with 30/40 pixels(this is approx. pixel height in which app screen detects the event for notification pull)
if(startPoint.y <= 40) {
Now you can set the statusBarHidden property to NO
@Cautions: -
Upvotes: 1