所以我现在真的对Objective-C和Xcode感到沮丧了哈哈……我正在尝试在代码进入和if语句的情况下弹出一个图像,它基本上检查用户是否在我的游戏中猜到了单词中的正确字母(想想绞死人)。一旦它进入if语句,我希望弹出一个图像,声明“恭喜!你得到了50分!”然后进入游戏中的下一个单词..。
所以代码看起来像这样:
if (isWordCompleted)
{
//do some code that has the pop up image
//other stuff as well
}
我已经找遍了stackoverflow,但似乎没有得到我想要的答案:
编辑:
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];
}
发布于 2013-01-21 03:49:05
当您的if语句执行时,则在if语句中打开另一个UIView & on View put
ImageView &也可以把你的图片放到ImageView中。或者,您也可以尝试在iPhone中使用PopupView。
将您的图像放入Popupview。来自以下工具的UIView是图像:
另请参阅图像视图添加图像图片:
https://stackoverflow.com/questions/14432240
复制相似问题