NavigationItem RightBarbuttonitemのイベントをプログラムでトリガーする方法は?
-
28-09-2019 - |
質問
次のコードでnavigationItem rightbarbuttonitemを作成し、そのイベントをプログラムでトリガーしたいと思います(Barボタンをクリックするのと同じように)。どこでも検索しますが、それを行う方法が見つかりません。誰かがこの方法を知っていますか?ありがとう。
UIBarButtonItem *reloadbutton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(Action1:)];
self.navigationitem.rightBarButtonItem = reloadbutton;
[reloadbutton release];
解決
ボタンを使用して使用しているアクションメソッドが既にあるため、自分でメソッドを呼び出すことができます。例えば、
[self Action1:self.navigationItem.rightBarButtonItem];
所属していません StackOverflow