我有一个在我的代码中运行的检查。如果检查返回 true,我将执行动画并向用户显示 UIAlertView。我的问题是我不知道如何延迟 UIAlertView 直到动画完成。因此,当前显示 UIAlertView 并看到动画在后台运行。我很感激这方面的任何帮助。以下是相关代码:
BOOL isComplete = [self checkJigsawCompleted:droppedInPlace withTag:tag];
if (isComplete) {
[stopWatchTimer invalidate];
stopWatchTimer = nil;
[self updateTimer];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
imgGrid.alpha = 0;
imgBackground.alpha = 0;
[UIView commitAnimations];
NSString *completedMessage = [NSString stringWithFormat:@"You completed the puzzle in: %@", lblStopwatch.text];
UIAlertView *jigsawCompleteAlert = [[UIAlertView alloc] //show alert box with option to play or exit
initWithTitle: @"Congratulations!"
message:completedMessage
delegate:self
cancelButtonTitle:@"I'm done"
otherButtonTitles:@"Play again",nil];
[jigsawCompleteAlert show];
}