我正在用 C4 编写一个程序,该程序由三个单独的按钮组成,按下时它们的形状都会发生变化。当我像这样为每个按钮创建一堆方法时:
@implementation MyButton
-(void)methodA {
C4Log(@"methodA");
[button1 ellipse:CGRectMake(centerPos.x - buttonWidth/2.0f, 80, buttonWidth, buttonHeight)];
}
-(void)methodB {
C4Log(@"methodB");
[button2 ellipse:CGRectMake(centerPos.x - buttonWidth/2.0f, centerPos.y - buttonHeight/2.0f, buttonWidth, buttonHeight)];
}
-(void)methodC{
C4Log(@"methodC");
[button3 ellipse:CGRectMake(centerPos.x - buttonWidth/2.0f, canvasHeight - 280, buttonWidth, buttonHeight)];
}
@end
...然后在画布上召唤他们...
[button1 listenFor:@"touchesBegan" fromObject:button1 andRunMethod:@"methodA"];
[button2 listenFor:@"touchesBegan" fromObject:button2 andRunMethod:@"methodB"];
[button3 listenFor:@"touchesBegan" fromObject:button3 andRunMethod:@"methodC"];
...我最终得到的只是一堆未声明的标识符错误。我究竟做错了什么?