ページ 1 / 1
[Objective-C]UIAlertViewの挙動について
Posted: 2014年7月10日(木) 17:05
by matunon
現在、AlertViewを使いまして、ボタンをタップしたときに画面遷移する。
というプログラムを組みたいと思っています。
ですが、何故か画面遷移する前に遷移先のviewDidLoadの処理を終らせてしまい、その後遷移するといった奇妙な挙動をするようになってしまいました。
原因を知りたいです。
お願いします。
► スポイラーを表示
コード:
- (void)RE {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"更新確認"
message:@"更新してもよろしいですか?"
delegate:self
cancelButtonTitle:@"はい"
otherButtonTitles:@"いいえ", nil];
[alert show];
}
// アラートのボタンが押された時に呼ばれるデリゲート例文
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
switch (buttonIndex) {
case 0:{
//1番目のボタンが押されたときの処理を記述する
NSLog(@"開始");
[self load];
NSLog(@"終了");
break;
}
case 1:{
//2番目のボタンが押されたときの処理を記述する
break;
}
}
}
- (void)load {
LoadingViewController *load = [self.storyboard instantiateViewControllerWithIdentifier:@"toLoad"];
//画面遷移する
[self.navigationController pushViewController:load animated:YES];
}
Re: [Objective-C]UIAlertViewの挙動について
Posted: 2014年7月11日(金) 08:35
by ookami
Re: [Objective-C]UIAlertViewの挙動について
Posted: 2014年7月11日(金) 12:40
by matunon