我几周来一直在努力解决这个问题。我有一个文字游戏,它比较单词,当一个字母在正确的位置,它变成绿色。现在这一切都很完美唯一的事情是我希望这些字母不是同时出现,而是在它们之间有一段时间。我不知道该怎么做,我希望有人可以帮助我。为了更清楚,这里有一些代码:
// RANDOM WORD
unichar aChar7 = [textview.text characterAtIndex:0];
unichar aChar8 = [textview.text characterAtIndex:1];
unichar aChar9 = [textview.text characterAtIndex:2];
unichar aChar10 = [textview.text characterAtIndex:3];
unichar aChar11 = [textview.text characterAtIndex:4];
unichar aChar12 = [textview.text characterAtIndex:5];
//INPUT
unichar aChar1 = [labelsText.text characterAtIndex:0];
unichar aChar2 = [labelsText.text characterAtIndex:1];
unichar aChar3 = [labelsText.text characterAtIndex:2];
unichar aChar4 = [labelsText.text characterAtIndex:3];
unichar aChar5 = [labelsText.text characterAtIndex:4];
unichar aChar6 = [labelsText.text characterAtIndex:5];
if (aChar1 == aChar7){
[imageview7 setImage:imageview1HG.image];
//(Wait 1 second)
if (aChar2 == aChar8){
[imageview8 setImage:imageview2HG.image];
///Wait 1 second)
if (aChar3 == aChar9){
[imageview9 setImage:imageview3HG.image];
//Wait 1 second)
if (aChar4 == aChar10){
[imageview10 setImage:imageview4HG.image];
//wait 1 second
if (aChar5 == aChar11){
[imageview11 setImage:imageview5HG.image];
//wait 1 second
if (aChar6 == aChar12){
[imageview12 setImage:imageview6HG.image];
我希望有人知道并且可以帮助我
答案 0 :(得分:0)
使用dispatch_after()
:
double delayInSeconds = 1.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
// code to be executed on the main queue after delay
});