でのユーザーの選択に基づいて、View Controller を変更しようとしていますUIAlertView
。私は目的の c に不慣れで、問題が発生しています。
ユーザーが「完了」を押すと、アプリが前のView Controllerに戻るようにします。ユーザーが「スコアボード」を押すと、アプリが次のビュー コントローラーに移動するようにします。
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", @"Scoreboard",nil];
[jigsawCompleteAlert show];
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
NSLog(@"Cancel Tapped.");
[self.navigationController popViewControllerAnimated:YES];
}
else if (buttonIndex == 1) {
NSLog(@"GO tapped.");
startDate = [NSDate date];
// Create the stop watch timer that fires every 10 ms
stopWatchTimer = [NSTimer
scheduledTimerWithTimeInterval:1.0/10.0
target:self
selector:@selector(updateTimer)
userInfo:nil
repeats:YES];
} else if (buttonIndex == 2) {
NSLog(@"Scoreboard tapped.");
}
}
popView 部分は機能しており、アプリは 1 つのビュー コントローラーに戻ります。アプリを1つのView Controllerに移動させる方法がわかりません。それが関係していることは知っていますがpushViewController
、これを行う方法を詳述しているかなり古くて矛盾した記事しか見たことがありません。
これについて少し助けていただければ幸いです、ありがとう。