//iOS8以上抛弃了UIAlertView 使用UIAlertController代替
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:@"" message:[NSString stringWithFormat:@"总分:%d",_count*100] preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"再玩一次" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
_count = 0;
[self addTimer];
_second = 0;
_countLabel.text = @"总分:0";
}];
[alertController addAction:cancelAction];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];
UIAlertView * alterView = [[UIAlertView alloc]initWithTitle:@"游戏结束" message:[NSString stringWithFormat:@"总分:%d",_count*100] delegate:self cancelButtonTitle:@"再玩一次" otherButtonTitles:@"确定", nil];
[alterView show];
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 0) {
_count = 0;
[self addTimer];
_second = 0;
_countLabel.text = @"总分:0";
}else{
}
}