Hello all ,
I have a question concerning hiding ,removing or adding a UIBarbuttonItem on UIToolbar.
I have a UIToolbar and two items. I wish to hide an item on the toolbar and when I enter for example third UITableview it will appear.
I've put this code in my viewDidload
instruct = [[UIBarButtonItem alloc]
initWithImage:[UIImage imageNamed:@"b_info.png"] style:UIBarButtonItemStylePlain target:self action:@selector(instruct_clicked:)];
instruct.title =@"instructions";
spacebetween = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
items = [NSMutableArray arrayWithObjects:vorige, spacebetween, aanwijzingen, spacebetween, nil];
[toolbar setItems:items]
Now what i would like is that at one moment in my program I call a function which either adds another item to the toolbar.
Example here
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
... ..
...
...
//and then something like this
[items addObject: anotherButton];
[toolbar setItems:items]
}
I figured I could just add another item to my mutableArray but unfortunately for me to no avail. Does anyone have a clue or an idea.