我定义了一个点函数
typedef void (^ButtonClick)(id sender);
我想在按钮单击时调用它(UIButton addTarget 调用 ^ButtonClick 函数),但它可以找到指针。
-(void)addRightButton:(UIImage*)btnImage click:(ButtonClick)click{
UIButton *modalViewButton = [UIButton buttonWithType:UIButtonTypeCustom];
[modalViewButton addTarget:self
action:@selector(click) // <==== could not find pointer.Pointer errors
forControlEvents:UIControlEventTouchUpInside];
// other code to add modelViewButton on View.....
}
-(void)test
{
[self addRightButton:[UIImage imageNamed:@"btn_shuaxin_1.png"] click:^(id sender) {
NSLog(@"it is test code");//<===never called
}];
}
怎么去SEL?