How do I remove a button from a view controller's toolbar on the iPhone?

Posted by Tony on Stack Overflow See other posts from Stack Overflow or by Tony
Published on 2010-04-11T20:15:56Z Indexed on 2010/04/11 20:23 UTC
Read the original article Hit count: 259

Filed under:
|
|

I have code that works great for adding a button to the toolbar:

NSArray* toolbarItems = [NSArray arrayWithObjects:flexibleSpace,shuffleBarItem,flexibleSpace,nil];
self.toolbarItems = toolbarItems;

However, I also want to be able to remove toolbar items. When I use the below method, my application crashes:

NSArray* toolbarItems = [NSArray arrayWithObjects:flexibleSpace,nil];
self.toolbarItems = toolbarItems;

Does anyone know how I can dynamically alter the toolbar on the iPhone?

Thanks!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about toolbaritems