Friday, April 17, 2009

Forcing a UIToolBar button to the right

By:
If you're adding a single button to a UIToolBar object and want it to be aligned to the right instead of the default left, add a UIBarButtonSystemItemFlexibleSpace button before it in the array of buttons. This will force your button to be on the right.


UIBarButtonItem *flexibleSpaceLeft = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];

[yourToolbar setItems:[NSArray arrayWithObjects:flexibleSpaceLeft, yourUIBarButtonItem, nil]];

[flexibleSpaceLeft release];


via: http://stackoverflow.com/questions/602717/aligning-uitoolbar-items

1 comments:

Anonymous said...

thanks much!

geez... couldn't figure this out...