title: Adding same button to all view controllers in UINavigationController
body: <p>I have a <code>UINavigationController</code> (to use like a wizard page) which I create programmatically and I need to display a "Cancel" button to cancel the process in any <code>UIViewController</code>.</p>
  
  <p><b>Creating the <code>UINavigationController</code>:</b></p>
  
  <pre><code>FirstVC *firstVC = [[[FirstVC alloc] initWithNibName:@"FirstPage" bundle:nil] autorelease];
  firstVC.delegate = self;
  
  navigationController = [[UINavigationController alloc] initWithRootViewController:firstVC];
  [self.view addSubview:navigationController.view];
  </code></pre>
  
  <p><b>Adding Cancel Button:</b></p>
  
  <pre><code>UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelRequestNewLeave:)];
  navigationController.topViewController.navigationItem.rightBarButtonItem = cancelButton;
  [cancelButton release];
  </code></pre>
  
  <p>But when I push a second page to <code>UINavigationController</code> the cancel button is not shown on the <code>UINavigationBar</code>. If I go back to first page, the cancel button is there. So, apparently the button is added only for the first view. I believe this is because I'm not subclassing <code>UINavigationController</code>, because I need to use it in a subview. But I don't know how to set the <code>rightBarButtonItem</code> in a <code>UINavigationController</code> which is created programmatically.</p>
  
  <pre><code>navigationController.topViewController.navigationItem.rightBarButtonItem = cancelButton;
  </code></pre>
  
  <p>Can someone shed a light on this?</p>
  
  <p>Thanks in advance.</p>