Semblable aux jeux Simon de l'ancien, je veux montrer à l'utilisateur une séquence de boutons & puis les faire répéter. L'endroit où je suis coincé montre le premier bouton mis en surbrillance, par exemple, 500ms, en attente 100ms, montrant le second en surbrillance pendant 500ms, en attendant une autre 100ms, montrant le 3ème & ainsi de suite.Comment afficher une séquence de boutons en surbrillance?
De autres Stackoverflower'ers j'ai appris à ce bloc:
redButton.highlighted = YES;
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationStartDate:[NSDate dateWithTimeIntervalSinceNow:1]];
[UIView setAnimationsEnabled:NO];
redButton.highlighted = NO;
[UIView commitAnimations];
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationStartDate: [NSDate dateWithTimeIntervalSinceNow:2]];
[UIView setAnimationsEnabled:NO];
blueButton.highlighted = YES;
[UIView commitAnimations];
Le redbutton mettra en évidence, mais aucune des actions subséquentes ont lieu.