title: Create NavBar programmatically with Button and Title Swift
body: <p>I try to create a NavBar, so far the NavBar is no problem but when I try to add the buttons and title, they don't get displayed</p>
  
  <p>My NavBar look like</p>
  
  <pre><code>let NameHeight = screenHeight * 0.09
  let NameWidth = screenWidth
  let navBar: UINavigationBar = UINavigationBar(frame: CGRect(x: 0, y: 0, width: NameWidth, height: NameHeight))
  self.view.addSubview(navBar)
  </code></pre>
  
  <p>so i try to set my NavBar title like </p>
  
  <pre><code>navigationBar.topItem.title = "some title"
  or
  navigationBar.title = "some title"
  </code></pre>
  
  <p>but both fail.<br>
  Also if i try to set a button</p>
  
  <pre><code>let btnName = UIButton()
  btnName.setImage(UIImage(named: "imagename"), forState: .Normal)
  btnName.frame = CGRectMake(0, 0, 30, 30)
  btnName.addTarget(self, action: Selector("action"), forControlEvents: .TouchUpInside)
  
  //.... Set Right/Left Bar Button item
  let rightBarButton = UIBarButtonItem()
  rightBarButton.customView = btnName
  self.navigationItem.rightBarButtonItem = rightBarButton
  </code></pre>
  
  <p>this does not give me a error but the button is simply not displayed </p>