ゲームでは...「完了」ボタンを押すと、2つの「ifステートメント」があります。1つは次のレベルに移動し、もう1つは家に戻ります。一度に1つだけが発生するようにするにはどうすればよいですか?現在の動作方法は、ユーザーが正しいか間違っているかに関係なく、勝ち負けの「アラートビュー」ポップアップの両方です。これはそれがどのように見えるかです:
-(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];
}
}