Web サービスの呼び出し中に進行状況インジケーター ビューでアラートを呼び出します。次のようにアラート ビューを設定しています。
[self.activityIndicatorView setHidden:NO];
self.alertView = [[UIAlertView alloc] initWithTitle:@"Sending Login Request.."
message:@"\n"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:nil];
self.activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
self.activityIndicatorView.center = CGPointMake(139.5, 75.5); // .5 so it doesn't blur
[self.alertView addSubview:self.activityIndicatorView];
[self.activityIndicatorView startAnimating];
[self.alertView show];
後でログインに失敗した場合は、self.alertView を閉じずに、アラート ビューに「OK」ボタンを配置し、self.alertView の新しいインスタンスを再度表示します。次のようなものです。
if (isThereErrorFromJsonResp) {
[self.activityIndicatorView stopAnimating];
[self.activityIndicatorView removeFromSuperview];
self.activityIndicatorView = nil;
[self.alertView setTitle:isThereErrorFromJsonResp];
//here i want to show ok button how?
return;
}
では、OKボタンをどのように配置すればよいでしょうか。なにか提案を?