ios - Fixed Space Bar Button Item places buttons outside of screen -


i want implement toolbar in ios app, displays app's logo in center of toolbar , shows + button on right side.

so, placed toolbar element on view, 2 bar button items (logo , add symbol) , placed 2 flexible space bar button items between them.

it looks this:

storyboard

while looks desired behavior, not in simulator:

simulator portrait mode

when testing app iphone 6s, logo part little bit more left, still not in center. doing wrong, because thought point of "flexible space bar button items" dynamically adapt different resolutions. it?

you should using uinavigationbar instead of uitoolbar.

uinavigationbar top of screen since has shadow on bottom edge. supports having title/titleview centred.

uitoolbar bottom of screen since has shadow on top edge. not have properties adding title have manually. also, flexible space lays out elements each flexible width item has same width.


Comments