カテゴリで実装していますが、
ViewControllerであればコピペで使えるレベルです。
実装
UIViewController+Alert.m
#import "UIViewController+Alert.h"
@implementation UIViewController (Alert)
- (void)showIndicatorAlert:(NSString*)text
{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:text preferredStyle:UIAlertControllerStyleAlert];
UIActivityIndicatorView *view = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
view.center = CGPointMake(60, 30);
[alertController.view addSubview:view];
[view startAnimating];
[self presentViewController:alertController animated:YES completion:nil];
}
@end
呼び出し元
[self showIndicatorAlert:@"Please wait..."];
表示結果

閉じる方法
別スレッドとかで
... 処理 ...
// 閉じる
dispatch_sync(dispatch_get_main_queue(), ^{
[self dismissViewControllerAnimated:true completion:nil];
});
Swift版
extension UIViewController {
func showIndicatorAlert(text: String) {
let alert = UIAlertController(title: text,
message: "",
preferredStyle: .alert)
let indicatorView = UIActivityIndicatorView(style: .medium)
indicatorView.center = CGPoint(x: 60, y: 30)
indicatorView.startAnimating()
alert.view.addSubview(indicatorView)
self.present(alert, animated: true, completion: nil)
}
}
- 表示
self.showIndicatorAlert(text: "Please wait...")
- 閉じる
self.dismiss(animated: true)