我初始化我的UIButton,推导器liek这样的:的UIButton addTarget:自...导致 “不承认选择” 错误
Button * it = [[Button alloc] initWithFrame:CGRectMake(x, y, image.size.width, image.size.height)];
然后,接下来我要做的:
[(UIButton *)self addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:self];
第一线路导致“不识别选择器”错误。
选择buttonClicked:看起来是这样的:
-(IBAction) buttonClicked:(id)sender {
if (action) action();
else NSLog(@"Clicked.\n");
}
我在做什么错?