views:

731

answers:

1

Hello,

I have a UIToolbar that I set up using IB with three buttons, left, middle and right. In some situations I would like to not display the middle button. Does anybody know of a way to hide a specific button on inside a UIToolBar? There is no hide property, all I can find is setEnable but this still leaves the button causing users to wonder what its purpose is. I would like to only display it in situations that it actually has a use.

Thanks in advance!

+3  A: 

Reset the items:

-(void)setItems:(NSArray *)items animated:(BOOL)animated

You can get the current items using the item property, then just remove the one you don't want to show and pass in the new NSArray.

As you can see, you can even animate it to make it clear to the user!

Chris Cooper
Ahh yes, this works. For some reason I originally thought it wouldn't but it does. Thanks!
jmurphy
@jmurphy: You're welcome! Glad you have it working.
Chris Cooper