我有一个数学问答游戏,我希望用户能够触摸按钮,现在只有当我将一个按钮设置为正确答案时它才会起作用。是否可以将其设置为按钮组合,例如答案是 53 用户可以触摸 5 按钮和 3 按钮。
视图控制器.m
-(IBAction)EasyLevel:(id)sender {
Question.hidden = NO;
SelectLevel.hidden = YES;
buttonOne.hidden = YES;
buttonTwo.hidden = YES;
buttonThree.hidden = YES;
buttonFour.hidden = YES;
buttonFive.hidden = YES;
buttonSix.hidden = YES;
buttonSeven.hidden = YES;
buttonEight.hidden = YES;
buttonNine.hidden = YES;
buttonZero.hidden = YES;
Right1.hidden = YES;
Right2.hidden = YES;
Right3.hidden = YES;
Right4.hidden = YES;
Right5.hidden = YES;
Right6.hidden = YES;
Right7.hidden = YES;
Right8.hidden = YES;
Right9.hidden = YES;
Right0.hidden = YES;
Wrong1.hidden = YES;
Wrong2.hidden = YES;
Wrong3.hidden = YES;
Wrong4.hidden = YES;
Wrong5.hidden = YES;
Wrong6.hidden = YES;
Wrong7.hidden = YES;
Wrong8.hidden = YES;
Wrong9.hidden = YES;
Wrong0.hidden = YES;
int EasyQuestion = arc4random() % 2 ;
switch (EasyQuestion) {
case 0:
Question.text = [NSString stringWithFormat: @"What is 4 X 2"];
Right1.hidden = NO;
Wrong3.hidden = NO;
Wrong4.hidden = NO;
Wrong5.hidden = NO;
Wrong6.hidden = NO;
Wrong7.hidden = NO;
Wrong8.hidden = NO;
Wrong9.hidden = NO;
Wrong0.hidden = NO;
buttonOne.hidden = NO;
buttonTwo.hidden = NO;
buttonThree.hidden = NO;
buttonFour.hidden = NO;
buttonFive.hidden = NO;
buttonSix.hidden = NO;
buttonSeven.hidden = NO;
buttonEight.hidden = NO;
buttonNine.hidden = NO;
buttonZero.hidden = NO;
buttonOne.text = [NSString stringWithFormat: @"1"];
buttonTwo.text = [NSString stringWithFormat: @"2"];
buttonThree.text = [NSString stringWithFormat: @"3"];
buttonFour.text = [NSString stringWithFormat: @"4"];
buttonFive.text = [NSString stringWithFormat: @"5"];
buttonSix.text = [NSString stringWithFormat: @"6"];
buttonSeven.text = [NSString stringWithFormat: @"7"];
buttonEight.text = [NSString stringWithFormat: @"8"];
buttonNine.text = [NSString stringWithFormat: @"9"];
buttonZero.text = [NSString stringWithFormat: @"0"];
break;
case 1: .....
default:
break; }
任何帮助表示赞赏,谢谢 :) Stephanie