iOS 5: Positioning Bar Button Item in a toolbar with Xcode/Storyboard

20,623

Drag in a flexible space item to the left of your UIBarButton. Put another one to the right if you want it centered, and so on.

The pertinent CS193p lecture is lecture 7 (the iPad one), he covers UIToolbar at the start of that.

enter image description here

Share:
20,623

Related videos on Youtube

Electro-Bunny
Author by

Electro-Bunny

Long time listener, first time caller...

Updated on March 23, 2020

Comments

  • Electro-Bunny
    Electro-Bunny over 4 years

    I have an existing toolbar in my View... when I drag a "Bar Button Item" into the tool bar it gets slammed to left side of the toolbar (I would like it to sit on the right edge). Attempting to drag the Bar Button only results in it being "gravity snapped" back to the left side. I see nothing in the size inspector that would allow me to align it to the right edge of the toolbar. The BarButton width can be changed, but seemingly nothing else. Can anyone please give me an idea of how to move it to the right?

    I will confess that I have a rookie/rudimentary understanding of (or lack thereof) Xcode/storyboarding gleaned from watching CS193p lecture videos (but I have not been able to relocate the lecture describing positioning within toolbars or pertinent documentation... a link would be welcomed.)

  • Mick MacCallum
    Mick MacCallum over 12 years
    @Dawgless Boyd if you feel that jrturton's answer has solved your problem, then please mark it as correct.
  • Adam Johns
    Adam Johns almost 10 years
    Note for others who make the same mistake I did: Make sure you grab the flexible space bar and not the fixed space bar, if you want to automatically align right.