0

私はこのコードを持っています:

- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
    MainGame *newview = [[MainGame alloc] initWithNibName:@"MainGame" bundle:nil];
    newview.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController:newview animated:YES];
}

また、画面をタッチするとMainGameというビューに切り替わりますが、画面をタッチしても何も起こらない場合があります。

私が言おうとしているのは、私のtouchesBeganがタッチを受信するのはたまにしかなく、それ以外の場合は無視されるということです。

このコードに加えて、次のように設定された約1〜4個のUIViewアニメーションも実行しています。

[UIView animateWithDuration:...];

ただし、アニメーションを削除すると、touchesBeganが常に認識されます。

では、なぜ私のアニメーションがtouchsBeginの認識を停止し、これが発生しないようにするにはどうすればよいのでしょうか。

4

1 に答える 1

1

UIView メソッドを使用します。

animateWithDuration:delay:options:animations:completion:

オプションを次のように設定します。

UIViewAnimationOptionAllowUserInteraction

これでうまくいくはずです。

于 2012-09-25T17:34:38.957 に答える