我初始化我的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");
}
我在做什麼錯?