title: How to add UINavigationBar in an UIViewController?
body: <p>I have an <code>UIViewController</code> class(Say it is XXX). I present this view controller as modally by the code..</p>
  
  <pre><code>XXX *xxx = [ [XXX alloc] init];
  [self presentModalViewController:xxx animated:YES];
  [xxx release];
  </code></pre>
  
  <p>I want to add a navigation bar on the top of the XXX view. So I used <code>UINavigationBar</code> object in XXX's <code>loadView</code> method.</p>
  
  <pre><code>UINavigationBar *navBar = [ [UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
  [self.view addSubview:navBar];
  [navBar release];
  </code></pre>
  
  <p>But, It throws an error as "EXC_BAD_ACCESS". Any help...?</p>
  
  <p>Thanks</p>