下一个按钮我在第5个按钮上点击第一个按钮,只有第二个按钮应该启用点击第二个按钮第三个按钮应启用。直到第4个按钮。启用点击第一个按钮
任何一个可以建议我要实施将不胜感激。
buttonArray = [[NSArray alloc] initWithObjects:@"4",@"3",@"4", nil];
// Cell for row index path added this code。
for (int buttonCount = 0; buttonCount< [[buttonArray objectAtIndex:indexPath.row] intValue]; buttonCount++)
{
int buttonSpace = 10 * buttonCount + 10;
cell.Button = [[CustomGoalButton alloc] initWithFrame:CGRectMake(buttonSpace + (buttonCount * 50),35, 50, 50)];
cell.Button.layer.cornerRadius = 25;
[cell.Button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
cell.Button.buttonIndex = buttonCount;
cell.Button.tag = 100 * (indexPath.row + 1)+ buttonCount;
if (buttonCount == 0) {
cell.Button.userInteractionEnabled = YES;
}
else{
cell.Button.userInteractionEnabled = NO;
}
[cell.ScrollView addSubview:cell.Button];
}
// Button Action
-(void)buttonAction:(CustomButton *)sender{
UITableViewCell *cell = (UITableViewCell *)[self. UITableView dequeueReusableCellWithIdentifier:@"TableViewCell"];
NSIndexPath *indexPath = [self. UITableView indexPathForCell:cell];
if (sender.selectedRowIndex == indexPath.row) {
sender.backgroundColor = [UIColor redColor];
sender.userInteractionEnabled = NO;
sender.tag = sender.tag+1;
}
}
你能分享一下你写的代码吗? –
你在tableview或scrollview中使用了概念 –
@Anbu。Karthik我在UITableView中使用 – kiran