所以我现在对 Objective-C 和 Xcode 感到非常沮丧,哈哈……如果代码输入和 if 语句,我试图弹出一个图像,它基本上检查用户是否猜到了正确的字母我的游戏中的单词(想想吊人)。一旦它进入 if 语句,我想弹出一个图像,上面写着“恭喜!你得了 50 分!” 然后移动到游戏中的下一个单词...
所以代码看起来像这样:
if (isWordCompleted)
{
//do some code that has the pop up image
//other stuff as well
}
我已经查看了整个stackoverflow,但似乎无法得到我正在寻找的答案:S
编辑:
if(isWordComplete)
{
//create an image reference to have pop up congratulating the user for guessing the right answer
UIImage *congratsImage = [UIImage imageNamed:@"Congrats.png"];
UIImageView *congratsImageView = [[UIImageView alloc] initWithImage:congratsImage];
[congratsImageView setFrame:CGRectMake(0, 0, 250, 158)];
[myDisplay setHidden:YES];
[myDisplay2 setHidden:YES];
[myDisplay3 setHidden:YES];
[myDisplay4 setHidden:YES];
[myDisplay5 setHidden:YES];
[myDisplay6 setHidden:YES];
[myDisplay7 setHidden:YES];
[self checkNumberofWordsUserCompleteInLevel:isWordComplete];
[self moveToNextWord];
}