0
我在我的tableView中使用CustomCell,只有几个按钮和标签。现在我想给这些按钮提供一些操作。任何人都可以帮助我如何为我的UIButton使用Action?TableView自定义单元格UIButton动作
的界面:
-(IBAction)btnAction;
在执行:
-(IBAction)btnAction
{
[self Evaluate:(int *)1 :(int *)2];
}
现在告诉我,我该怎么分配在一个UIButton的行动我的UIButton在我的手机?
@StuDev:我有BeginingCell.h和BeginingCell.m为CustomCell.And我在GameTableView(另一个类)中使用它。在哪里应该把这些代码? – 2011-04-18 06:29:52
@ sohel_14_cse_ju:如果我理解正确,我会说,一个好方法是在BeginingCell类中使用UIButton(使用@property声明,并使用@synthesize生成访问器/增变器),以便您可以从你的GameTableView访问它。然后,当你在GameTableView中初始化你的单元格时,你会做类似'[myBeginningCell.theButton addTarget:action:forControlEvents]'(假设你的BeginingCell.h中的button属性被称为'theButton')。 – Stuart 2011-04-18 06:44:33
我的outlet是在beginingCell中定义的。根据你的指导,这是正常的。我只是想尝试像这样[BeginingCellObject.ansBtn1 addTarget:btnAnsEval:forControlEvents];与btnAnsEval Method.Bit错误,它显示它没有声明。但我在tableView类中正确地做了。任何想法是怎么回事? – 2011-04-18 08:30:03