title: Make my UIViewController fullscreen in Objective-C
body: <p>I have an Objective C project which uses XIB files (not storyboards).</p>
  
  <p>I have a UIViewController view that I lunch from my AppDelegate.m file which plays a video.  I want to make it full screen but the title
  bar at the top is showing and there is a thin white line down the left hand side of the screen.</p>
  
  <p>How can I make the whole video play full screen.</p>
  
  <p><strong>AppDelegate.m</strong></p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
      self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  
      VideoIntroViewController *videoIntroViewController = [[VideoIntroViewController alloc] initWithNibName:@"VideoIntroViewController" bundle:nil];
      videoIntroViewController.managedObjectContext = self.managedObjectContext;
  
      self.navigationController = [[UINavigationController alloc] initWithRootViewController:videoIntroViewController];
      self.window.rootViewController = self.navigationController;
      [self.window addSubview:self.navigationController.view];
  
      [self.window makeKeyAndVisible];
  
    return YES;
  }
  </code></pre>
  
  <p><strong>VideoIntroViewController.m</strong></p>
  
  <pre><code>- (void)viewWillAppear:(BOOL)animated
  {   
      [super viewWillAppear:animated];
  
      if (!self.navigationController.toolbarHidden)
      {
          [self.navigationController setToolbarHidden:YES animated:animated];
      }
  }
  
  - (void)viewDidLoad
  {
      [self createVideoPlayer];
  
      [super viewDidLoad];
  }
  
  - (void)createVideoPlayer
  {
      NSString *filePath = [[NSBundle mainBundle] pathForResource:@"welcome_video" ofType:@"mp4"];
      NSURL *url = [NSURL fileURLWithPath:filePath];
  
      AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:url];
  
      self.player = [AVPlayer playerWithPlayerItem:playerItem];
      self.player.volume = PLAYER_VOLUME;
  
      AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.player];
      playerLayer.videoGravity = UIViewContentModeScaleToFill; &lt;-- 'Null passed to a callee that requires a non-null argument'
      playerLayer.frame = self.playerView.layer.bounds;
      [self.playerView.layer addSublayer:playerLayer];
  
      [self.player play];
  
      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayDidEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:self.player.currentItem];
  }
  </code></pre>