1

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.

0

1 Answer 1

2

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)
Sign up to request clarification or add additional context in comments.

4 Comments

works, but i get yellow triangle saying "immutable value "space" was never used". i called the "space button" for "space"..
Sounds like you have two different variables and only use one of them. Get rid of the extra one you aren't using.
sorry im not catching up with you. Which variables am i not using?
The one that Xcode is putting the yellow triangle on. It's tell you that you never used it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.