title: MPMoviePlayer leaving a space above NavigationBar
body: <p>Screenshot found here: <a href="https://i.stack.imgur.com/fru4x.png" rel="nofollow noreferrer">http://i.stack.imgur.com/fru4x.png</a></p>
  
  <p>So I have a UITableViewController pushing a UIViewController that has a MPMoviePlayer object in it. What i've discovered is that when I load in the MPMoviePlayer as a subview, it creates a statusbar. This statusbar pushes down the navigationbar a the top, causing the white space. I've looked at a bunch of different topics on stackoverflow and nothing seems to work: </p>
  
  <p><a href="https://stackoverflow.com/questions/1041060/iphone-weird-space-at-the-top-of-uinavigationcontroller">iPhone: Weird space at the top of UINavigationController</a></p>
  
  <p><a href="https://stackoverflow.com/questions/1054539/not-sure-why-uiview-is-being-nudged-up-by-around-10px">Not sure why UIView is being nudged up by around 10px</a></p>
  
  <p><a href="https://stackoverflow.com/questions/4671881/empty-white-line-under-uitableview-after-close-mpmoviewplayer-from-fullscreen-m">Empty (white) line under UITableView after close MPMoviewPlayer from fullscreen mode</a></p>
  
  <p><a href="https://stackoverflow.com/questions/3653236/hide-statusbar-from-mpmovieplayercontroller">Hide StatusBar from MPMoviePlayerController</a></p>
  
  <p>The UIViewController is being pushed with the following code (PresetViewController.m): </p>
  
  <pre><code>-(void)tableView:(UITableView *)tableView 
  didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  {
      NSUInteger row = [indexPath row];
      //PresetNode *tempNode = [appDelegate.presetData objectAtIndex:row];
  
     ..... SOME DATA IS LOADED HERE
  
  [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
      MoviePlayer *player = [[MoviePlayer alloc] initWithNibName:nil bundle:nil andVideoArray: presetVideoURLs];
      [self.navigationController pushViewController:player animated:NO];
      [player playVideoAtIndex:0];
      [player release];
  
  [tableView deselectRowAtIndexPath:indexPath animated:YES];
  }
  </code></pre>
  
  <p>When the view controller loads, for some reason it loads in a statusbar at the top of its view even though I use this code in MoviePlayer.m: </p>
  
  <pre><code>- (void)viewDidAppear:(BOOL)animated{
  [[UIApplication sharedApplication] setStatusBarHidden:YES];
  [super viewDidAppear:animated];
  [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
  [self becomeFirstResponder];
  }
  </code></pre>
  
  <p>I set the movie to landscape mode and play it. Then I check to see if the done button is pressed. If the done button is pressed, I pop the view. For some reason, when the view gets popped, the uitableviewcontroller behind it gets pushed down by a few pixels. The statusbar the movieplayer created pushes everything down. Here is the movieplayer code (MoviePlayer.m): </p>
  
  <pre><code>-(void) playVideoAtIndex: (NSInteger)index{
  
  NSString *rootPath = [[NSBundle mainBundle] resourcePath];
  NSString *filePath = [rootPath stringByAppendingPathComponent: [self.movieArray objectAtIndex:index]];
  NSURL *fileURL = [NSURL fileURLWithPath:filePath isDirectory:NO];
  self.yourMoviePlayer = [[MPMoviePlayerController alloc] initWithContentURL: fileURL];
  
  [yourMoviePlayer setControlStyle:MPMovieControlStyleFullscreen];
  
  
  
  [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
  [[UIApplication sharedApplication] setStatusBarHidden:YES];
  
  [[self navigationController] setNavigationBarHidden: YES];
  
  yourMoviePlayer.scalingMode = MPMovieScalingModeFill;
  [[yourMoviePlayer view] setTransform:CGAffineTransformMakeRotation(M_PI/2)];
  self.yourMoviePlayer.view.frame = self.view.frame;
  
  [yourMoviePlayer setFullscreen:YES animated:NO];
  
  [[NSNotificationCenter defaultCenter] 
   addObserver:self
   selector:@selector(checkForNextMovie:)                                                 
   name:MPMoviePlayerPlaybackDidFinishNotification
   object:yourMoviePlayer];
  
  [[self view]addSubview:yourMoviePlayer.view];
  //[[self navigationController] presentMoviePlayerViewControllerAnimated:self];
  //---play movie---
  [yourMoviePlayer play];    
  
  }
  
  -(void) checkForNextMovie:(NSNotification*) aNotification {
  MPMoviePlayerController *player = [aNotification object];
  [[NSNotificationCenter defaultCenter] 
   removeObserver:self
   name:MPMoviePlayerPlaybackDidFinishNotification
   object:player];
  
  NSNumber *reason = [[aNotification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
  
  [yourMoviePlayer release];
  if((currentIndex+1) == [self.movieArray count] || [reason intValue] == MPMovieFinishReasonUserExited){
      [[NSNotificationCenter defaultCenter] removeObserver:self];
      [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
      [player.view removeFromSuperview];
      [[self navigationController] setNavigationBarHidden: NO];
      [[UIApplication sharedApplication] setStatusBarHidden:YES];
      //self.wantsFullScreenLayout = YES;
  
      [[self navigationController] popViewControllerAnimated:NO];
      if ([UIApplication sharedApplication].statusBarOrientation != self.interfaceOrientation) {
          [[UIApplication sharedApplication] setStatusBarOrientation:self.interfaceOrientation animated:NO];
      }
  }
  else{
      currentIndex++;
      [self playVideoAtIndex: currentIndex];
  }
  }
  </code></pre>