在游戏中……当按下“完成”按钮时,有两个“if 语句”:一个带您进入下一个级别,另一个带您回家。我怎样才能让它一次只发生一次?它现在的工作方式是无论用户是对还是错,都会弹出获胜和失败的“警报视图”。这是它的外观:
-(IBAction)done {
if ([entry.text isEqualToString:sentance.text]) {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Cleared!"
message:@""
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles: nil];
[alert show];
[alert release];
seconds.text = @"5 Seconds";
}
if ([entry.text isEqualToString:entry.text]) {
NSString *nssScore= [NSString stringWithFormat:@"Final Score: \n %i Points", Score];
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Nope! Wrong"
message:nssScore
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles: nil];
[alert show];
[alert release];
}
}