Reputation: 147
I have a UIToolbar with 3 UIBarButtonItems and a flexible space on either side. I'm using this to navigate through an array while using the center UIBarButtonItem as a title.
The situation looks like this:
<--> [<] [Title] [>] <-->
When at the beginning of the array, I'd like to remove the [<] button and vice versa when reaching the end of the array for the [>] button.
How do I keep the [Title] button centered so that it doesn't move when one of the other UIBarButtons gets removed/added?
Notes:
I already know how to add/remove buttons programmatically in a toolbar
The problem is that every time, it centers around both remaining UIBarbuttons, where I need it to center on just the title.
Upvotes: 1
Views: 311
Reputation: 3558
You can replace the [>] or [<] buttons with a fixed width spacer when you reach the end/beginning of the pages.
Upvotes: 1