In this post you will found coding tips related to UIStatusBar.

Status Bar in iPhone

1. How to hide status bar in ios.

 [[UIApplication sharedApplication] setStatusBarHidden:YES];

OR

if you want to do this with animation then

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

Here, For animation parameter “withAnimation” you can use following options :

  • UIStatusBarAnimationFade
  • UIStatusBarAnimationSlide
  • UIStatusBarAnimationNone

2. How to change status bar style.

 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];

OR

 [[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleDefault animated:YES];

Here, For status bar style parameter “setStatusBarStyle” you can use following options :

  • UIStatusBarStyleDefault,
  • UIStatusBarStyleBlackTranslucent,
  • UIStatusBarStyleBlackOpaque

StatusColor Settings in iOS

3. How to change status bar orienatation.

 [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];

OR

if you want to perform this with animation

 [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:YES];

Here you can use following options as parameter for "setStatusBarOrientation"
  • UIInterfaceOrientationPortrait
  • UIInterfaceOrientationPortraitUpsideDown
  • UIInterfaceOrientationLandscapeLeft
  • UIInterfaceOrientationLandscapeRight

change status bar orienatation in iOS

Happy coding !!!