プログラムでテーブルビューに追加された UIButton があります。問題は、触れたときに認識されないセレクターがインスタンスに送信されたというエラーメッセージに遭遇することです。
UIButton *alertButton = [UIButton buttonWithType:UIButtonTypeInfoDark];
[alertButton addTarget:self.tableView action:@selector(showAlert:)
forControlEvents:UIControlEventTouchUpInside];
alertButton.frame = CGRectMake(220.0, 20.0, 160.0, 40.0);
[self.tableView addSubview:alertButton];
InfoDark UIButtonがタッチされたときにトリガーしたいアラートメソッドは次のとおりです。
- (void) showAlert {
UIAlertView *alert =
[[UIAlertView alloc] initWithTitle:@"My App"
message: @"Welcome to ******. \n\nSome Message........"
delegate:nil
cancelButtonTitle:@"Dismiss"
otherButtonTitles:nil];
[alert show];
[alert release];
}
助けてくれてありがとう。