ユーザー入力を無効にするために同期ネットワーク呼び出しを使用しないでください。それを提案した人は誰でも、あなたに非常に悪いアドバイスをしました。
現在のビューとそのサブビューの入力を無効にするだけの場合はself.view.userInteractionEnabled = NO;
、View Controller で行うことができます。
ウィンドウ全体の入力を無効にしたい場合は、次のことができますself.view.window.userInteractionEnabled = NO;
ユーザー インターフェイスの上に全画面表示を重ねる場合は、ユーザー インタラクションを無効にする必要はまったくありません。あなたのモックアップ画像に基づいて、これがあなたがやろうとしていることだと思います. これを行うには、次のようにします。
self.overlayView = [[[UIView alloc] initWithFrame:self.view.window.bounds] autorelease];
self.overlayView.backgroundColor = [UIColor blackColor];
self.overlayView.alpha = 0.5f;
[self.view.window addSubview:self.overlayView];
self.activityIndicator = [[[UIActivityIndicator alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite] autorelease];
self.activityIndicator.center = self.view.window.center;
[self.view.window addSubview:self.activityIndicator];
[self.activityIndicator startAnimating];
self.activityLabel = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease];
self.activityLabel.text = @"Loading...";
[self.activityLabel sizeToFit];
self.activityLabel.center = CGPointMake(self.activityIndicator.center.x, self.activityIndicator.center.y - self.activityIndicator.frame.size.height);
[self.view.window addSubview:self.activityLabel];