UIstatusbar Coding Tips For Beginners.
Krupanshu.Sharma
August 19, 2013
UIstatusbar Coding Tips For Beginners.2014-02-22T03:01:57+00:00
Iphone Development
In this post you will found coding tips related to UIStatusBar.
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
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
Happy coding !!!