Dear all I have implemented two buttons in the navigation bar on the right side on top of a text view as;
UIToolbar* toolbar = [[UIToolbar alloc]
initWithFrame:CGRectMake(0, 0, 112, 44.5)];
// toolbar style is the default style
// create an array for the buttons
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:3];
// create a button to run the job
UIBarButtonItem *runButton = [[UIBarButtonItem alloc]
initWithTitle:@"RUN"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(runAs:)];
// Button style is the default style
[buttons addObject:runButton];
[runButton release];
// create a spacer between the buttons
UIBarButtonItem *spacer = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
target:nil
action:nil];
[buttons addObject:spacer];
[spacer release];
// create a standard Edit/Done button with custom titles Edit/Save
self.editButtonItem.possibleTitles = [NSSet setWithObjects:@"Edit", @"Save", nil];
self.editButtonItem.title = @"Edit";
UIBarButtonItem *editButton = self.editButtonItem;
[buttons addObject:editButton];
[editButton release];
// put the buttons in the toolbar and release them
[toolbar setItems:buttons animated:YES];
[buttons release];
// place the toolbar into the navigation bar as Right Button item
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]
initWithCustomView:toolbar];
[toolbar release];
Now in Edit mode I want to hide the RUN button and when the RUN button is in action I want the Edit button to be hidden. Can someone suggest me a way to do that without redefining the buttons in edit mode (like there is for the back/left button item setHidesBackButton:(BOOL) animated:(BOOL)) or any alternate method? Thanks a lot.