title: Adding Navigation Bar programmatically iOS
body: <p>I am trying to make an App with a Navigation Bar (Back button, title, etc) and a Tab Bar (Toolbar on the bottom). I am using subviews so I don't have to worry about the status bar, navigation bar, tab bar heights, etc.  But I think it's causing me trouble because I can't seem to figure out how to setup the Nav and Tab Bars.</p>
  
  <p>Here is what I have. What am I doing wrong?</p>
  
  <p>AppDelegate.h</p>
  
  <pre><code>(default for single view app)
  </code></pre>
  
  <p>AppDelegate.m</p>
  
  <pre><code>(default for single view app)
  </code></pre>
  
  <p>ViewController.h</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  @interface ViewController : UIViewController
  @property (strong, nonatomic) UIView *contentSubview;
  @end
  </code></pre>
  
  <p>ViewController.m</p>
  
  <pre><code>#import "ViewController.h"
  @interface ViewController ()
  @end
  
  @implementation ViewController
  - (void)loadView{}
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      UIView *view = [[UIView alloc] init];
      view.backgroundColor = [UIColor greenColor];
      self.contentSubview = [[UIView alloc] init];
      self.contentSubview.backgroundColor = [UIColor orangeColor];
      [view addSubview:self.contentSubview];
      self.view = view;
  }
  
  - (void)viewWillLayoutSubviews
      {
      [super viewWillLayoutSubviews];
      self.contentSubview.frame = CGRectMake(
                                         0,
                                         self.topLayoutGuide.length,
                                         CGRectGetWidth(self.view.frame),
                                         CGRectGetHeight(self.view.frame)-self.topLayoutGuide.length-self.bottomLayoutGuide.length
                                         );
  }
  
  
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  @end
  </code></pre>