UIToolbarでUIBarbuttonItemを非表示、削除、または追加することに関する質問があります。テーブルビューで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 [email protected]"instructions";
spacebetween = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
items = [NSMutableArray arrayWithObjects:vorige, spacebetween, aanwijzingen, spacebetween, nil];
[toolbar setItems:items]
にこのコードを入れてきましたが、私のプログラム内の1つの瞬間に、私はツールバーに別の項目を追加するいずれかの関数を呼び出すことです。
ここで例
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
... ..
...
...
//and then something like this
[items addObject: anotherButton];
[ツールバーsetItems:アイテム]
}
私はちょうど無駄に私のmutableArrayに別の項目を追加しますが、残念ながら私のためでした考え出しました。 誰かがヒントやアイデアを持っていますか?
オハイオ州オタクでしたが、これは修正されました;)今すぐ修正しました –
thnx ..;)ビットがあまりにも薄い –
aha gotcha ... ... –