下一個按鈕我在第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