Mick
Mick

Reputation: 187

Remove UIToolBar Buttons not working

I'm trying to hide toolbar buttons. First In my viewDidLoad I hide some of them and that works perfectly. I do not want to hide btnCreateReport Yet. I just use:

NSMutableArray     *items = [[myToolBar.items mutableCopy] autorelease];
[items removeObject: btnEmailReport];
[items removeObject: btnSaveToIpad];
[items removeObject: btnPrintReport];
[items removeObject: btnNewInspection];
myToolBar.items = items;

Later when I try to Hide 2 of them using:

NSMutableArray     *items = [[myToolBar.items mutableCopy] autorelease];
[items addObject: btnEmailReport];
[items removeObject: btnSaveToIpad];
[items addObject: btnPrintReport];
[items addObject: btnNewInspection];
[items removeObject:btnCreateReport];
myToolBar.items = items;

the btnCreateReport does not go away. What can cause something like that? Thanks!!

Upvotes: 3

Views: 700

Answers (1)

Mick
Mick

Reputation: 187

It's Fixed. Turns out The code works perfectly. Just a newbie mistake. I was using it in the wrong ibAction.

Upvotes: 2

Related Questions