【发布时间】:2013-10-30 10:34:10
【问题描述】:
这个话题在 stackoverflow 上到处都是,但我找不到合适的解决方案。
我在每个UITableViewCell 上都有按钮。
这是我创建单元格的方法。
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ExaminationCell"];
UIButton *clipButton = (UIButton *)[cell viewWithTag:3];
MedicalExamination *examination = [objects objectAtIndex:indexPath.row];
[clipButton addTarget:self action:@selector(examinatonClicked:) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
这是处理按钮单击的方法:
-(void)examinatonClicked:(MedicalExamination*)examination
{
}
如何将检查对象传递给examinatonCommentsClicked 方法?显然每个单元格的对象都不同...
【问题讨论】:
-
您可以使用此答案中提供的有关 UIButton 的解决方案并将多个参数传递给其选择器:stackoverflow.com/a/53779104/5324541
标签: ios uitableview selector