我做了一个Tic-Tac-Toe游戏。如果游戏以平局结束,则会出现动画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];
到目前为止,我没有尝试过任何工作。任何帮助将不胜感激。