這是一個愚蠢的簡單的動畫,但我不斷得到這個惱人的「表達結果未使用」的警告。代碼如下:惱人的「表達結果未使用」警告
-(IBAction)thingOneTapped:(UIGestureRecognizer *)sender{
if ((isLevel = YES)) {
thingOneEnded = YES;
goingToThingOne = [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(otherThingToOne) userInfo:nil repeats:YES];
x = 11;
y = 118;
}
else (isLevel = NO); {
[self viewDidLoad];
}
}
-(void)otherThingToOne{
if ((isLevel = YES) && (isLevelOne = YES)) {
if ((x > 0) && (y > 0)) {
otherThing.center = CGPointMake(otherThing.center.x - .5, otherThing.center.y - 5.35);
x = x - .5;
y = y - 5.35;
}
else ((x < 0) && (y < 0)); {
[self levelOneDefault];
// EVIL WARNING IS RIGHT HERE IN THE ELSE PART
}
}
爲了檢查平等,你需要使用==(即兩個等號),這就是爲什麼你得到錯誤。此外,您的代碼目前無法按預期工作。 – Fogmeister 2014-12-06 23:51:47
總是簡單的事情哈哈感謝 – PICKme 2014-12-06 23:52:20
擺脫'else'行末尾的分號。 – rmaddy 2014-12-06 23:57:22