我想在吃豆子游戏我从一些网站上得到了使用此代码,但不得不改变UIAlertView
到UIAlertController
除了下面的代码有两个错误,我不知道如何解决(我真的很新的节目,觉得这是一个真的新手问题 - 抱歉!)
第一个错误在第4行:选择器没有已知的类方法 alertControllerWithTitle
第二个错误出现在最后一行:没有可见的接口声明选择器 show
- (void)collisionWithExit: (UIAlertController *)alert {
if (CGRectIntersectsRect(self.pacman.frame, self.exit.frame)) {
[self.motionManager stopAccelerometerUpdates];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Congratulations"
message:@"You've won the game!"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil
preferredStyle:UIAlertControllerStyleAlert];
[alert show];
}
}
Run Code Online (Sandbox Code Playgroud)