【发布时间】:2013-09-15 10:37:30
【问题描述】:
我有一个带有五行和一个按钮的 UitableView。我设法为一行创建复选标记,我的意思是用户只能检查一行。当检查另一行时,前一个未选中。现在有人可以帮助我如何将我的按钮与行的选择联系起来。我尝试了一些方法,但没有成功。
这是我在 cellForRowAtIndexPath 中的代码:
if([self.checkedIndexPath isEqual:indexPath])
{
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
else
{
cell.accessoryType = UITableViewCellAccessoryNone;
}
还有我的按钮代码:
if (reloadSelectedRow==1) {
PlayViewController * controller = [[PlayViewController alloc] initWithNibName:@"PlayViewController" bundle:nil];
//controller.countdownLabel.text= score;
[self presentViewController:controller animated:YES completion:nil];
}
}
reloadSelectedRow 是一个 int 变量,我创建它 .h 并在 didSelectRowAtIndexPath 中将其用作:
reloadSelectedRow = [[NSNumber alloc] initWithInteger:indexPath.row];
问题是当我按下按钮时没有任何反应。提前谢谢你。
【问题讨论】:
标签: ios uitableview uibutton tableview