所以我在viewController的viewDidLoad方法中放了一個while循環,但是當我加載視圖控制器時它不起作用並給了我一個SIGTERM。這是while循環的代碼。While loop not working
- (void)viewDidLoad
{
while (appDelegate.gobletCheckInt == 0 || appDelegate.gobletCheckInt == 1) {
if (CGRectIntersectsRect(mainSprite.frame, getGobletImg.frame)) {
haveGobletImg.image = [UIImage imageNamed:@"Gold Goblet.png"];
}
}
appDelegate = [[UIApplication sharedApplication]delegate];
getGobletImg.image = [UIImage imageNamed:@"Gold Goblet.png"];
}
那些最後兩行沒有多大關係。所以我不應該把它放在viewDidLoad中?
這沒有奏效。還有其他建議嗎? – 2011-12-29 03:09:30
你可以發佈一部分堆棧跟蹤嗎?當應用程序終止時,調試器停止哪行?你的成員變量的值是什麼?如果不移動app循環上方的AppDelegate賦值,我不明白上面的代碼如何工作,但您可能需要的不僅僅是這些。沒有看到更多的代碼很難說。 – user1118321 2011-12-29 05:54:33