ここに私のコードにあるメソッドがあります:
-(IBAction) actionButtonPressed: (id) sender{
NSLog(@"%@",actionButton.titleLabel.text);
if (actionButton.titleLabel.text == @"Begin Recording"){
[actionButton setTitle:@"Finish Recording" forState:UIControlStateNormal];
[actionButton setTitle:@"Finish Recording" forState:UIControlStateApplication];
[actionButton setTitle:@"Finish Recording" forState:UIControlStateHighlighted];
[actionButton setTitle:@"Finish Recording" forState:UIControlStateReserved];
[actionButton setTitle:@"Finish Recording" forState:UIControlStateSelected];
[actionButton setTitle:@"Finish Recording" forState:UIControlStateDisabled];
UIImage *redButton = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"bigredbutton" ofType:@"png"]];
[actionButton setBackgroundImage:redButton forState:UIControlStateNormal];
[actionButton setBackgroundImage:redButton forState:UIControlStateApplication];
[actionButton setBackgroundImage:redButton forState:UIControlStateHighlighted];
[actionButton setBackgroundImage:redButton forState:UIControlStateReserved];
[actionButton setBackgroundImage:redButton forState:UIControlStateSelected];
[actionButton setBackgroundImage:redButton forState:UIControlStateDisabled];
}
if (actionButton.titleLabel.text == @"Finish Recording"){
[self dismissModalViewControllerAnimated:YES];
}
}
何らかの理由で NSLog 呼び出しが機能し、コンソールに表示されます。このボタンは、Begin Recording と読み始めますが、このメソッドを呼び出すために Interface Builder の Touch Up Inside と結び付けられて参照されているにもかかわらず、ボタンを押しても何も起こりません。