UIButton
我用以下代码创建了一个:
UIButton* queenButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
queenButton.frame = CGRectMake(0,50,30,30);
[queenButton setTitle:@"Q" forState:(UIControlState)UIControlStateNormal];
[queenButton addTarget:self action:(SEL)[self performSelector:@selector(promotePawnAt:to:) withObject:end withObject:@"Q"] forControlEvents:UIControlEventTouchUpInside];
当我这样做时,编译器会给出一个错误,说Cast of an Objective-C pointer to 'SEL' is disallowed with ARC
. 当我移除(SEL)
演员表时,我得到Implicit conversion of an Objective-C pointer to 'SEL' is disallowed with ARC
.
我想要做的是让程序promotePawnAt:to:
在按下按钮时调用,但是该函数需要参数,所以@selector(promotePawnAt:to:)
不起作用。