三目並べのゲームを作りました。ゲームが引き分けで終了した場合、アニメーション化された hudView が数秒間表示されます。その後、ゲームが最初からやり直され、そのときに問題が発生します。「X」または「O」を描くために画面をタップしても反応しなくなりました。私の疑いは、hudViewがまだそこにあるということです。私はそれを取り除くためにさまざまなことを試みましたが、運がありませんでした。
+ (instancetype)hudInView:(UIView *)view animated:(BOOL)animated
{
HudView *hudView = [[HudView alloc] initWithFrame:view.bounds];
hudView.opaque = NO;
[view addSubview:hudView];
view.userInteractionEnabled = NO;
[hudView showAnimated:YES];
return hudView;
}
そしてアニメーション:
- (void)showAnimated:(BOOL)animated
{
if (animated) {
self.alpha = 0.0f;
self.transform = CGAffineTransformMakeScale(1.3f, 1.3f);
[UIView animateWithDuration:4.5 animations:^{
self.alpha = 1.0f;
self.transform = CGAffineTransformIdentity;
} completion:^(BOOL finished) {
self.alpha = 0.0f;
}];
}
}
完了ブロックでは、次のことを試しました。
[self.superview removeFromSuperview];
これがすべて呼び出されるViewControllerで、私は試しました:
HudView *hudView = [HudView hudInView:self.view animated:YES];
hudView.text = @"\tIt's a Tie\n";
[hudView removeFromSuperview];
[self.view removeFromSuperview]
[hudView.superview removeFromSuperview];
これまでに試したことは何もありません。どんな助けでも大歓迎です。