iphone - if 语句后警报框在模拟器上卡住

标签 iphone ios xcode

这是我上一个问题的后续

我有这个代码

基本上,它的意思是,当计时器到达时,您会收到一个消息框,说“做得好”等,然后屏幕重置,您可以再次玩,所有图像重置,开始按钮重新出现,但您无法清除警报框刚刚卡住在SIM卡上,我是不是错过了什么?

这是代码

if (MainInt <= 0)
    {
        [timer invalidate];
        timelabel.text = @"5";

        [startbutton setHidden:NO];


        CGRect frame = [player frame];
        frame.origin.x = 137.0f;
        frame.origin.y = 326.0;
        [player setFrame:frame];

        CGRect frame2 = [enemy frame];
        frame2.origin.x = 90.0f;
        frame2.origin.y = 20.0;
        [enemy setFrame:frame2];

        CGRect frame3 = [enemy2 frame];
        frame3.origin.x = 210.0f;
        frame3.origin.y = 20.0;
        [enemy2 setFrame:frame3];

        UIAlertView *alert1 = [[UIAlertView alloc] initWithTitle:@"GRATZ" message:[NSString stringWithFormat: @"Congratulations you made it to Level : %d Now try then next level" ,fred] delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];


        [alert1 show];
        [alert1 release];

    }

最佳答案

听起来您正在创建多个并将它们放在一起。

尝试重置您的 MainInt = 5; 就像您在上一个问题中重置 timeLabel.text

关于iphone - if 语句后警报框在模拟器上卡住,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11070218/

相关文章:

ios - MoPub 快速集成无法正常工作

swift - 尝试将食物对象添加到数组导致崩溃在展开可选值时意外发现 nil

iphone - 在 Xcode 中制作 iPhone 应用程序时,如何制作应用程序图标而不让手机添加默认的玻璃效果眩光?

java - 我可以在 iPhone 的网络浏览器上运行嵌入网页的 Java Applet 吗?

iphone - 子类化实现 MKMapViewDelegate 的类,但未调用 MKMapViewDelegate 方法

ios - 将 NSLog 保存到本地文件中

iphone - UIButton setFont 在 iPhone 2G iOS 3.1.3 上失败

objective-c - ivars 的行为不符合预期

ios - 如何重现罕见的 "_CFAutoReleasePoolPop"崩溃?

xcode - 如何将swift编译器添加到objective c项目