Site icon Dipin Krishna

iOS: Hide/Show the Status bar in an iPhone/iPad application

xcode

Lets see how to change the visibility of the status bar in an iphone/ipad application.

The UIApplication class provides a centralized point of control and coordination for applications running on iOS.

Every application must have exactly one instance of UIApplication (or a subclass of UIApplication). When an application is launched, the UIApplicationMain function is called; among its other tasks, this function creates a singleton UIApplication object. Thereafter you can access this object by invoking the sharedApplication class method.

This object has a method setStatusBarHidden, which can be used to change the visibility of the status bar.

To hide the status bar, use:

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];

To show the status bar, use:

[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];

Hope, it helpd! 🙂

Exit mobile version