1

I wish to have a "fullscreen mode" in my iPhone application where when a user presses a button, the statusbar, navigationbar, and toolbar animates out of the screen (like the fullscreen feature of Safari in landscape mode in iOS 6). I am basically showing a UINavigationController with a UIViewController as the top view controller.

I can hide the elements by doing this from the UIViewController:

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

    [self.navigationController setToolbarHidden:YES animated:YES];

    [self.navigationController setNavigationBarHidden:YES animated:YES];

However, the animations are not synchronized, and the resizing of the content is not completely fluid. If you play with the Safari fullscreen feature, you can see that the animation is perfectly fluid. Any ideas on how I can achieve this with perfect animation?

spybart
  • 2,583
  • 3
  • 22
  • 33
  • similar .. http://stackoverflow.com/questions/21929220/show-hide-uitoolbar-match-finger-movement-precisely-as-in-for-example-ios7-s – Fattie Feb 28 '14 at 20:37

1 Answers1

0

You can do the following:

[UIView animateWithDuration:0.4 animations:^() {
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
    [self.navigationController setToolbarHidden:YES animated:NO];
    [self.navigationController setNavigationBarHidden:YES animated:NO];
    self.yourView.frame = CGRectMake(0, 0, 320, 480); // If you have several views, set all their frames to 'fullscreen'
}];

You can use custom animations by using the method UIView animateWithDuration:( delay: options: animations:^(void)animations completion:^(BOOL finished)completion, just check out the UIViewAnimationOptions.

Martol1ni
  • 4,684
  • 2
  • 29
  • 39
  • 1
    Thanks for the response, but that solution isn't quite what I'm looking for. Although it does help to syncronize the status bar animation time with the other 2, it doesn't quite make things as fluid as I would like. It's hard to describe the issue since it's about animation, if I get desperate I'll start posting videos of the animations of mine and this solution. – spybart Oct 14 '12 at 21:37
  • I, too, tried this, and unfortunately the rates at which things change don't quite match up. – Rick Jun 28 '16 at 22:40