错误:由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[UIView setTitle:forState:]:无法识别的选择器发送到实例 0x9688830”
标签 1-8 确实存在并且使用 IB 正确分配。此操作已
与使用 IB 的“重新启动”按钮相关联。
- (IBAction)restart: (UIButton *) sender
{
NSLog(@"restart");
[board restart];
NSString *buttonText = @"";
for(int i=0;i<9;i++)
{
UIButton *button = (UIButton *)[self.view viewWithTag:i];
[button setEnabled:YES];
NSLog(@"yourObject is a: %i", className);
// THIS CAUSES A RUNTIME ERROR:
//[button setTitle:buttonText forState:UIControlStateNormal];
}
}