Hi,
suppose you have a done button of UIBarButtonItem and u want to hide it and show it programmatically depends upon your requirement.so you have do like following...
To Hide:
Declaration
UIBarButtonItem *donebutton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemD one target:self action:@selector(ondoneButtonPressed)];
self.navigationItem.rightBarButtonItem = donebutton;
for hide:
self.navigationItem.rightBarButtonItem = nil;
To Show:simply call
self.navigationItem.rightBarButtonItem = donebutton;
It will work for UIBarButtonItem , donebutton.hidden=YES will not work.
You can enable/disable by simply writing donebutton.enable=YES/NO.
Do not know about in which iphone environment for u r working but the given code will work for hiding and showing the UIBarButton for requirements in ur program.
swarnalata