title: Adding UINavigationBar to UIView Programmatically?
body: <p>I am trying to add a UINavigationBar to a UIView programmatically and having so success, and can't figure it out. I am trying to add it in my UIView subclass and it simply isn't showing up when I run my app.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, headerHeight)];
      [navBar setBackgroundColor:[UIColor blueColor]];
      [self addSubview:navBar];
  
      UIBarButtonItem *doneItem = [[UIBarButtonItem alloc] initWithTitle:@"done" style:UIBarButtonItemStylePlain target:self action:@selector(done:)];
  
      UINavigationItem *navItem = [[UINavigationItem alloc] initWithTitle:@"categories"];
      [navItem setRightBarButtonItem:doneItem animated:YES];
      [navBar setItems:[NSArray arrayWithObject:navItem] animated:YES];
  </code></pre>