views:

42

answers:

1

i hav removed items from tool bar,but i want to re add it at particular time ... how to do it.. i dont have images for them....

NSMutableArray *itemsToReplaceOldOnes=[[NSMutableArray alloc] initWithArray:self.toolbar.items]; [itemsToReplaceOldOnes removeObjectAtIndex:2]; //remove UIBarButtonItems you want to remove [self.toolbar setItems:itemsToReplaceOldOnes animated:YES];

A: 

UIBarButtonItem does not inherit from UIView, and so does not contain a hidden property. If you're using a UIToolbar use:

 NSMutableArray *itemsToReplaceOldOnes=[[NSMutableArray alloc] initWithArray:self.toolbar.items];
[itemsToReplaceOldOnes removeObjectAtIndex:2]; //remove UIBarButtonItems you want to remove
[self.toolbar setItems:itemsToReplaceOldOnes animated:YES];
Felixs
yes ,i have using same,but is showing request for member hidden is not a structure or union..
lak in iphone
Ok, you could've specified that, 'is not working' isn't particularly useful. Could you maybe edit your question to show some code to see how you are using/accessing the UIButton?
Felixs
when i using ur code also is giving same error
lak in iphone
I assume you have set a property for the UIToolbar. self.toolbar is just for example's sake
Felixs
yes...but have you set a property for the toolbar?
Felixs
thank you ur code is working
lak in iphone
how to re add removed items from toolbar
lak in iphone
I would recommend you don't hide the, just 'grey' them out, like so: [self.toolbar.items objectAtIndex:1].enabled=NO; then re-enable them: [self.toolbar.items objectAtIndex:1].enabled=NO;
Felixs