インジケータ表示の方法

APIとかネットワーク負荷がかかるような処理がバックグラウンドで起きている場合に
UIActivityIndicatorViewを用いてインジケータを表示する方法


UIActivityIndicatorView *indView = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
indView.frame = CGRectMake(0, 0, 32, 32);
indView.center = CGPointMake(160, 240);
indView.hidesWhenStopped = YES;
[self.view addSubview:indView];

[indView startAnimating];
[[NSRunLoop currentRunLoop]runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.0]];
[indView stopAnimating];
[indView removeFromSuperview];
[indView release];