Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.)

like image 940
Electro-Bunny Avatar asked Sep 11 '25 16:09

Electro-Bunny


1 Answers

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

like image 90
jrturton Avatar answered Sep 16 '25 07:09

jrturton