Question

I have a toolbar in UIView form and a bar button to the right which has a huge caption "Add blah to blah" and no left bar button, The right bar button segues to multiple screens depending on UIform value on right button click.

I now need to add a button in center that does something else. I want this button to be in center irrespective of portrait or landscape. I added fixed space on either side to keep the center button in center. But the button goes to left in landscape mode, though it looks good in portrait.

Had it been programmatically adding, something like below might have worked

self.toolbarItems = [NSArray arrayWithObjects:flexibleSpaceBarButton, centerButton, flexibleSpaceBarButton, bigCaptionButton2, nil];

But most of the things have been done on storyboard and this new button needs to be in center. Is there a easy way to center a button in toolbar on a UIView in storyboard in both landscape and portrait mode ?

This is a toolbar button at the bottom of UIView form Thanks

Was it helpful?

Solution

Drag flexible space objects from the object library and insert them on either side of the button you want centered.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top