UIToolBar で完了ボタンがクリックされたときに、「TableViewController」の .nib を表示したいと考えています。ただし、以下では、クリックして新しいビューを表示することはできません。これを修正するにはどうすればよいですか?どこが間違っていたのか、何を置き換える必要があるのか、その理由を教えてください。
//Here's the selector in my overlay.
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:
UIBarButtonSystemItemDone target:self action:@selector(doneButtonPressed)];
//Here's how I made my action. Btw, the uitoolbar has no nib, it's an overlay on the
//(camera mode).
-(void)doneButtonPressed {
TableViewController *tableView = [[TableViewController alloc]
initWithNibName:@"TableViewController" bundle:nil];
tableView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:tableView animated:YES];
}
//Yet nothing happens when I click on my done button on my overlay. And I've made sure
// i've imported .h frameworks correctly too.
UItoolbar オーバーレイ上にある barbuttonitem から nib を表示するとします。どのようにしますか?
適切に機能させるには、[barButtonItem addTarget:self action:@selector(doneButtonPressed) forControlEvents:UIControlEventTouchUpInside]; を追加する必要があると言われました。.
しかし、それを追加すると、次のようになります。
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:
UIBarButtonSystemItemDone addTarget:self action:@selector(doneButtonPressed)
forControlEvents:UIControlEventTouchUpInside];
その結果、「インスタンスメソッド' - initWithBarButtonSystemItem:target:action:forControlEvents:' not found (return type defaults to 'id')」というエラーが表示されます
正しい添加剤だけを示すのではなく、ここに書いたコードに加えて解決策を示してください。