How do I get two buttons in the center of a navigation bar ios
<p><a href="https://i.stack.imgur.com/0c4up.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0c4up.png" alt="enter image description here"></a></p>

<p>I would like to implement the following image in Swift for my navigation bar.  I have tried the following code, however, it just stack the buttons on top of each other </p>

<pre><code>let fromButton:UIButton = UIButton(frame: CGRectMake(0,0,80,44))
let toButton:UIButton = UIButton(frame: CGRectMake(80,0,80,44))

fromButtonView.bounds = fromButton.frame
fromButton.addSubview(fromButtonView)

toButtonView.bounds = toButton.frame
toButton.addSubview(toButtonView)

var myView:UIView = UIView(frame: CGRectMake(0,0,160,44))

myView.addSubview(toButton)
myView.addSubview(fromButton)

self.navigationItem.titleView = myView
</code></pre>

<p>fromButtonView and toButtonView are variables with the views implemented as xibs.</p>

<p>The resulting navigation header looks as follows, can't figure out where I am going awry.  The views are stacking on top of each other.</p>

<p><a href="https://i.stack.imgur.com/sLArA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sLArA.png" alt="enter image description here"></a></p>