-2

IOS 5 でストーリーボードを使用しています。画像処理が重いため、viewdidload でローディング ビュー ポップアップをロードする必要があります。ローディングビューは表示されません。以下のコードをさまざまな場所で試してみたところ、うまくいきました。viewdidloadではありません。

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notify_action_finish:) name:@"StopLoadingView" object:nil];
loadingView =[tfbLoadingView loadingViewInView:[self.view.window.subviews objectAtIndex:0]];

前もって感謝します。

4

1 に答える 1

1

エリックがコメントで述べているように、ビューのロードにはMBProgressHudを使用します。

ウィンドウのサブビューとしてHUDを追加します。

    // Should be initialized with the windows frame so the HUD disables all user input by covering the entire screen
    HUD = [[MBProgressHUD alloc] initWithWindow:[UIApplication sharedApplication].keyWindow];

    // Add HUD to screen
    [self.view.window addSubview:HUD];

    // Register for HUD callbacks so we can remove it from the window at the right time
    HUD.delegate = self;

    HUD.labelText = NSLocalizedString(@"Loading Workbench", nil);
    HUD.detailsLabelText = NSLocalizedString(@"please wait", nil);

    // Show the HUD while the provided method executes in a new thread
    [HUD showWhileExecuting:@selector(loadWorkbench:) onTarget:self withObject:nil animated:YES];

次のデリゲートメソッドを追加します。

- (void)hudWasHidden {
    // Remove HUD from screen 
    [HUD removeFromSuperview];

    // add here the code you may need

}

MBProgressHUDDelegateまた、対応するヘッダーファイルを追加することを忘れないでください。

于 2012-08-24T21:32:22.617 に答える