Iphone didSelectRowAtIndexPath中UIButton上的if语句

Iphone didSelectRowAtIndexPath中UIButton上的if语句,iphone,objective-c,uitableview,uibutton,Iphone,Objective C,Uitableview,Uibutton,我有一个UITableView,在每个单元格中我有2个自定义按钮,我要做的是使用DidSelectRowatingIndexPath方法,我想做一个if语句,在哪个按钮上被触动 所以我实际上是把一个细胞一分为二 但我不知道如何编写if语句 任何帮助都将受到极大欢迎 谢谢我认为苹果的示例“附件”应用程序正是你想要做的。查看设置自定义单元格中的按钮及其 -(无效)添加目标:(id)目标操作:(SEL)controlEvents的操作:(uicontrol事件)controlEvents 设置适当的方

我有一个UITableView,在每个单元格中我有2个自定义按钮,我要做的是使用DidSelectRowatingIndexPath方法,我想做一个if语句,在哪个按钮上被触动

所以我实际上是把一个细胞一分为二

但我不知道如何编写if语句

任何帮助都将受到极大欢迎


谢谢

我认为苹果的示例“附件”应用程序正是你想要做的。查看

设置自定义单元格中的按钮及其 -(无效)添加目标:(id)目标操作:(SEL)controlEvents的操作:(uicontrol事件)controlEvents
设置适当的方法。

谢谢大家的帮助,但我找到了我要找的解决方案。就是这样

在cellForRowAtIndexPath方法中

[[cell team1Button] addTarget:self
                       action:@selector(shield1Touched:)
             forControlEvents:UIControlEventTouchUpInside];

    [[cell team2Button] addTarget:self
                           action:@selector(shield2Touched:)
                 forControlEvents:UIControlEventTouchUpInside];

}
[[cell team1Button] setTag:[indexPath row]];
[[cell team2Button] setTag:[indexPath row]];
设置标记,以便在自定义单元格中选择按钮时,应用程序知道选择了哪一行

那么,在你按下按钮的方法

- (IBAction)shield1Touched:(id)sender;{
WorldCupAppDelegate *appDelegate = [UIApplication sharedApplication].delegate;

    int rowOfButton = [sender tag];
ScoreDetails *scoreDetail = [appDelegate.liveMatch objectAtIndex:rowOfButton];
因此,您可以根据在哪个单元格上触碰哪个按钮来执行所需的所有操作

希望这对其他人有帮助


信息来源是

hmm,不是真的,因为这是一张辅助图像,我要找的是if(UIButton1接收到的触摸){if(UIButton2接收到的触摸){如果这有帮助,但是如果你想确认UIButton中的触摸,只需设置一个如上所述的操作。我这里缺少什么?