title: How to add a navigation controller/bar to iOS?
body: <p>I am currently trying to add a navigation bar for every screen. However I want to programmatically add different types of buttons available on different screens, specifically on the different slide drawer menu items. Also, I want to be able to have a back button for nested screens. </p>
  
  <p>I have read about the navigation controller and I see there is just a navigation bar that I can add to my xib file, but not sure how to implement it exactly. If I add a navigation bar to the xib file do I have to reference it somehow in my controller or should adding it be enough, because adding this line does not add the items to the navigation bar.</p>
  
  <p>This is the code I add in my MainViewController.m file:</p>
  
  <pre><code>//add navigation top bar items
          UIBarButtonItem *shareItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:nil];
          UIBarButtonItem *cameraItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action:nil];
  
          NSArray *actionButtonItems = @[shareItem, cameraItem];
          self.navigationItem.rightBarButtonItems = actionButtonItems;
  </code></pre>