Fade In-Out Time iOS UI Status Bar

I have an application in which you click on UIImageView and the buttons disappear and return. The status bar does the same, except that it just arrives quickly. Is there a way to make it fade according to the settings of the buttons? Here is my .m file where there is code for the buttons and the status bar.

.m

- (void)viewDidLoad { ////Loads UIImageView from URL todaysWallpaper.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.inkdryercreative.com/daily/archive/mondays/images/062-mondays-960x640-A.jpg"]]]; _buttonsVisible = false; [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageTapped:)]; [todaysWallpaper addGestureRecognizer:tapGesture]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [[UIApplication sharedApplication] setStatusBarHidden:YES]; } - (void)imageTapped:(UIGestureRecognizer *)sender { float targetA = 0; if(_buttonsVisible == NO) { targetA =1.0; } else { [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(imageTapped:) object:nil]; [[UIApplication sharedApplication] setStatusBarHidden:YES]; [[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleBlackTranslucent]; [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade]; } [UIView beginAnimations:@"MoveAndStrech" context:nil]; [UIView setAnimationDuration:1]; [UIView setAnimationBeginsFromCurrentState:YES]; homeButton.alpha = targetA; infoButton.alpha = targetA; saveButton.alpha = targetA; tweetButton.alpha = targetA; [UIView commitAnimations]; _buttonsVisible = !_buttonsVisible; if(_buttonsVisible) { [self performSelector:@selector(imageTapped:) withObject:nil afterDelay:100.0]; [[UIApplication sharedApplication] setStatusBarHidden:NO ]; [[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleBlackTranslucent]; } } 

Any help or guidance would be greatly appreciated. My client wants this to be done on Tuesdays or to find someone else to do this. I put my life in this application, so if you can help share the knowledge. thanks

+2
source share
4 answers

You can wrap it in an animation block. Just use the setStatusBarHidden: method instead of setStatusBarHidden:withAnimation:

 [UIView beginAnimations:@"foo" context:nil]; [UIView setAnimationDuration:1.0]; [[UIApplication sharedApplication] setStatusBarHidden:YES]; [UIView commitAnimations]; 
+8
source

You can try this, this is the only code for all iOS devices:

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

Hope this helps.

+3
source

Try setting the status bar using the code below:

  [[UIApplication sharedApplication] setStatusBarHidden: YES 
                                         withAnimation: UIStatusBarAnimationFade];
+3
source

What you can do is create your own NavigationBar (do not use the UINavigationController UINavigationBar). You can then customize it and assign it easily animated properties such as alpha.

+1
source

All Articles