title: How to fade BOTH status bar and navigation bar LIKE Photos.app, on iOS 7
body: <p>Basically, it's a very simple demand, but I've tried several methods and none of them works as expected. The closest functioning snippet is:</p>
  
  <pre><code>#import "ViewController.h"
  
  @implementation ViewController
  
  - (void)dealloc
  {
      [scrollView release];
      scrollView = nil;
  
      [super dealloc];
  }
  
  - (id)init
  {
      if (self = [super init])
      {
          self.title = @"Pictures";
  
          scrollView = [[UIScrollView alloc] init];
          scrollView.delegate = self;
          scrollView.frame = CGRectMake(0.0f, 0.0f, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
          scrollView.contentSize = CGSizeMake([UIScreen mainScreen].bounds.size.width * 10, scrollView.bounds.size.height);
          scrollView.showsVerticalScrollIndicator = NO;
          scrollView.showsHorizontalScrollIndicator = NO;
          scrollView.pagingEnabled = YES;
          scrollView.userInteractionEnabled = YES;
          scrollView.backgroundColor = [UIColor blackColor];
          self.wantsFullScreenLayout = YES;
          self.automaticallyAdjustsScrollViewInsets = NO;
          isHidden = NO;
      }
      return self;
  }
  
  - (void)viewDidLoad
  {
      UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
      [scrollView addGestureRecognizer:tapGesture];
      [tapGesture setNumberOfTapsRequired:1];
      [tapGesture release];
  
      for (int i = 0; i &lt; 10; i++)
      {
          UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"/path/to/%d.png", i + 1]];
          UIImageView *imageView= [[UIImageView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width * i, 0.0f, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
          imageView.contentMode = UIViewContentModeScaleAspectFit;
          imageView.image = image;
          [scrollView addSubview:imageView];
          [image release];
          [imageView release];
      }
  
      [self.view addSubview:scrollView];
  }
  
  - (void)tap:(UITapGestureRecognizer *)gesture
  {
      [UINavigationBar setAnimationDuration:1.0];
      [UINavigationBar beginAnimations:@"HideTopBars" context:nil];
  
      isHidden = !isHidden;
      // [self setNeedsStatusBarAppearanceUpdate];
  
      self.navigationController.navigationBar.alpha = isHidden ? 0.0f : 1.0f;
      [UINavigationBar commitAnimations];
  }
  
  - (void)scrollViewDidScroll:(UIScrollView *)view
  {
      // further operation
  }
  
  - (BOOL)prefersStatusBarHidden
  {
      return isHidden;
  }
  @end
  </code></pre>
  
  <p>Without "[self setNeedsStatusBarAppearanceUpdate]", navigation bar does fade as expected, but texts on status bar remain visible, which I guess is because status bar takes navigation bar as it's background image and status bar itself doesn't fade; With "[self setNeedsStatusBarAppearanceUpdate]", the texts also fade, but navigation bar's animation becomes sliding in/out from the top of the screen along with fade effect. I've also tried to move "[self setNeedsStatusBarAppearanceUpdate]" into prefersStatusBarHidden, but that just made navigation bar visible forever. I believe this is not an odd demand, so I bet there're better and simpler solutions. Any idea?</p>