Adam
Adam

Reputation: 135

Swift Toolbar / navigationbar

I have a really stupid question. On the top of the bar we have Navigation bar, and you can put on both left and right side a barbutton item and a title in the middle.

On the bottom i put a normal toolbar but when i try putting 2 bar buttons on each side they both go to the left. I tried with a navigation bar on the bottom and it works putting a bar button on each side but i can't add mission constraints on it. So im stuck trying to figure out how to make a toolbar on the bottom to add the missing constraints and be able to put 2 bar button items on it, on the left and the right side.

Thanks in advance.

Upvotes: 1

Views: 610

Answers (1)

rmaddy
rmaddy

Reputation: 318955

Add a button with a system type of "flexible space" between the two buttons. This will put the first button on the left, the "space" in the middle, and the second button on the right.

Put this button between the two other buttons on the toolbar:

let space = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)

Upvotes: 2

Related Questions