我在我的tableView中使用CustomCell。只有几个按钮和标签。现在我想给这些按钮一些动作。有人能告诉我如何在UIButton中使用Action吗?
:
-(IBAction)btnAction;
在实现中:
-(IBAction)btnAction
{
[self Evaluate:(int *)1 :(int *)2];
}
现在告诉我如何在UIButton中分配动作?单元格中有UIButton
你可以使用addTarget:action:forControlEvents:
方法(UIControl的一个方法,UIButton是它的子类)通过编程的方式给UIButton添加一个动作。
所以你的实现看起来像这样:
[myButton addTarget:self
action:@selector(btnAction)
forControlEvents:UIControlEventTouchUpInside];