すべてUIActivityIndicator
のビューの上でアニメーションを開始する があります。彼がアニメーションを開始した直後に、この現在のビューの親ビューがポップされます。彼がアニメートした後、ブロックを使用して別のクラスを呼び出し、いくつかのサーバー コマンドを実行します。
私の問題は、他のクラスでサーバーからの応答を取得しているが、
UIActivityIndicator
彼が他のクラスにいるため、停止するように指示できないことです。(Application Delegate には何も実装したくないと言わざるを得ません)。
サーバー クラスでは、応答を取得した後に がUIAlertView
表示されますが、UIAlertView
はサーバー クラス内に実装されています。UIActivityIndicator
そこはやめてほしいところです。
私はそれをよく理解しているといいのですが、そうでない場合は教えてください。
ありがとうございました。
- (void)buttonPressed:(id)sender
{
UIView * darkView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
darkView.backgroundColor = [UIColor blackColor];
darkView.alpha = 0.5f;
UIActivityIndicatorView * activityIndicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[darkView addSubview:activityIndicator];
activityIndicator.center = darkView.center;
[activityIndicator startAnimating];
[[UIApplication sharedApplication].keyWindow addSubview:darkView];
// Inside this class (ShareByEmail) there is a UIAlertView that should stop the
// animation that already running right now.
ShareByEmail *sbe = [[ShareByEmail alloc]init];
[sbe share];
[self.navigationController popViewControllerAnimated:YES];
}