UIToolbar の UIBarbuttonItem の非表示、削除、または追加について質問があります。
UIToolbar と 2 つの項目があります。ツールバーの項目を非表示にしたいのですが、たとえば 3 番目の UITableview に入ると表示されます。
このコードを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]
今私が望むのは、私のプログラムのある瞬間に、ツールバーに別の項目を追加する関数を呼び出すことです。
例はこちら
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
... ..
...
...
//and then something like this
[items addObject: anotherButton];
[ツールバー setItems:アイテム]
}
mutableArray に別のアイテムを追加するだけでよいと考えましたが、残念ながら役に立ちませんでした。誰にも手がかりやアイデアがありますか。