title: make button in tableview section header float/align right programmatically // Swift
body: <p>I trying to align of float a UIButton to the right in the section header of a TableView universally.
  So far I only managed to add constraints for one screen size...</p>
  
  <p>Here is my code so far:</p>
  
  <pre><code>override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -&gt; UIView? {
      var headerFrame:CGRect = tableView.frame
  
      let titelArr: NSArray = ["1", "2", "3", "4", "5", "6"]
      var title = UILabel(frame: CGRectMake(10, 10, 100, 30))
      title.font = UIFont.boldSystemFontOfSize(20.0)
      title.text = titelArr.objectAtIndex(section) as? String
      title.textColor = UIColor.whiteColor()
  
  
      var headBttn:UIButton = UIButton.buttonWithType(UIButtonType.ContactAdd) as UIButton
      headBttn.frame = CGRectMake(320, 10, 30, 30)
      headBttn.enabled = true
      headBttn.titleLabel?.text = title.text
      headBttn.tag = titelArr.indexOfObject(titelArr.objectAtIndex(section))
      headBttn.addTarget(self, action: "addItem:", forControlEvents: UIControlEvents.TouchUpInside)
  
      var headerView:UIView = UIView(frame: CGRectMake(0, 0, headerFrame.size.width, headerFrame.size.height))
      headerView.backgroundColor = UIColor(red: 108/255, green: 185/255, blue: 0/255, alpha: 0.9)
      headerView.addSubview(title)
      headerView.addSubview(headBttn)
  
      return headerView
  
  }
  </code></pre>
  
  <p>How can I make the button float right? The rest of the constraints can stay as they are...</p>
  
  <p>THX for your help!</p>
  
  <p>//Seb</p>