Duration UIStatusBarAnimationFade

I have an application in which I have a button that disappears on the screen to black. I want the status bar to fade to black too, so I use the following code:

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

Is it possible to set the attenuation duration? If this is not feasible, is it possible to get the official attenuation duration (for example, using UIKeyboardAnimationDurationUserInfoKey to get the duration of the keyboard slides).


Well, I haven’t received anything from anyone, but I think I should at least share my hack. After some experiments, I settled on a gradual disappearance for 1 second and the attenuation is 0.25 seconds.

 - (IBAction)fadeToBlack:(id)sender { UIView *view = [[[UIView alloc] initWithFrame:self.view.window.frame] autorelease]; view.backgroundColor = [UIColor blackColor]; view.alpha = 0.0; [self.view.window addSubview:view]; // NOTE: Fading the black view at the same rate as the status bar. Duration is just a guess. [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade]; [UIView animateWithDuration:1.0 animations:^{ view.alpha = 1.0; } completion:^(BOOL finished) { [view addGestureRecognizer:self.dismissViewGesture]; }]; } - (void)dismissViewWithGesture:(UIGestureRecognizer *)gesture { UIView *view = gesture.view; [view removeGestureRecognizer:gesture]; // NOTE: Fading the black view at the same rate as the status bar. Duration is just a guess. [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade]; [UIView animateWithDuration:0.25 animations:^{ view.alpha = 0.0; } completion:^(BOOL finished) { [view removeFromSuperview]; }]; } 
+4
source share
1 answer

I had the same problem and my values ​​are 0.5 for hiding and 0.2 for showing the navigation bar along with the status bar. At least for iOS 6.1 / iOS Simulator, these values ​​are much better true.

0
source

All Articles