title: add "done" button to navigation bar without using uinavigationcontroller
body: <p>I have a view controller that I would like to be able to dismiss with a upper right "done" button on the nav bar. I am not using uinavcontoller, but just added the nav bar like this in my viewDidLoad:</p>
  
  <pre><code>  bar = [[UINavigationBar alloc] init];
  </code></pre>
  
  <p>in .h:</p>
  
  <pre><code>IBOutlet UINavigationBar *bar;
  </code></pre>
  
  <p>And of course, connected the nav bar on IB. </p>
  
  <p>Then I tried to add a nav item also within viewDidLoad but nothing happens:</p>
  
  <pre><code>rightButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonSystemItemDone target:nil action:nil];
  UINavigationItem *item = [[UINavigationItem alloc] initWithTitle:@"Title"];
  item.rightBarButtonItem = rightButton;
  item.hidesBackButton = YES;
  [bar pushNavigationItem:item animated:NO];
  </code></pre>
  
  <p>Please note - there are a few questions like that here, but none of them answers this exact question.</p>
  
  <p>thanks for the help! </p>