特定のアクションの実行中にUIAlertView
ポップアップして進行状況スピナーを表示する があります。そのアクションには、進行状況のアラートをプログラムで破棄し、操作が完了したことを示す新しいアラートをポップアップ表示するコールバック メソッドがあります。
ViewController は進行状況スピナー アラートのデリゲートとして機能しますが、プログラムによる呼び出しdismissWithClickedButtonIndex
は散発的にしか発生しません。不足しているもの、または目的を達成するための別の方法がありますか (基本的に、スピナー ダイアログを表示し、操作が完了したことを警告します)
コード
進行状況アラート コード
progressAlert = [[UIAlertView alloc] initWithTitle:@"Title"
message:@"Progress Message"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:nil, nil];
progressAlert.tag = kAlertViewProgress;
[progressAlert show];
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
indicator.center = CGPointMake(progressAlert.bounds.size.width / 2, progressAlert.bounds.size.height - 50);
[indicator startAnimating];
[progressAlert addSubview:indicator];
[manager runOperation:parameters
successBlock:^(id response) {
// Callback should dismiss the progress dialog and then the delegate
// handler should show the second UIAlertView
// This only seems to call the delegate occasionally though
[progressAlert dismissWithClickedButtonIndex:0 animated:NO];
}];
プログレス アラートが却下されました
- (void)alertView:(UIAlertView*)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
switch (alertView.tag) {
case kAlertViewProgress:
if (buttonIndex == 0) {
dispatch_async(dispatch_get_main_queue(), ^{
[self showCompletedAlert:@"Completed Message"];
});
} else if (buttonIndex == 1) {
dispatch_async(dispatch_get_main_queue(), ^{
[self showCompletedAlert:@"Error Message"];
});
}
break;
}
}
アップデート
どうやら はUIAlertView
メソッドを呼び出してwillDismissWithButtonIndex
いますが、 を呼び出していませんdidDismissWithButtonIndex
。何が起こっているかについての手がかりはありますか?