title: How do I add a back button to my UINavigationBar?
body: <p>A user arrives at this viewController from the previous one through a push segue, so I want there to be a back button in the <code>UINavigationBar</code> to allow them to return. </p>
  
  <p>Normally this back button would appear by default if I right clicked on the viewController in storyboard and selected <code>Embed in</code> > <code>Navigation Controller</code>, but doing this is causing crashes, and I prefer doing things programmatically, so I decided to do it in <code>viewDidLoad</code> like so:</p>
  
  <pre><code>    // Nav bar
      UINavigationBar *navbar = [[UINavigationBar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
  
      // Back Button
      UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style: UIBarButtonItemStyleBordered target:self action:@selector(Back)];
      self.navigationItem.leftBarButtonItem = backButton;
  
      [self.view addSubview:navbar];
  </code></pre>
  
  <p>This successfuly adds a navigation bar up top, but it doesn't add the back button as expected. I've tried the solutions given <a href="https://stackoverflow.com/questions/17749838/how-to-manually-add-a-back-button-to-my-navigationbar">here</a>, <a href="https://stackoverflow.com/questions/28144470/how-do-i-add-a-back-button-to-the-navigation-bar-through-storyboard">here</a>, and <a href="https://stackoverflow.com/questions/7464903/how-do-i-add-back-button-to-uinavigationbar-programmatically">here</a>, but none have solved the problem. </p>