2013-04-17 9 views
7

Ho un buttono nella voce di navigazione che azione è BUTTON_ACTION. Premendolo, MBProgressHUD si attiva e l'azione funziona. ma il "dimBackground" che rende "nascosto" lo scrren, non funziona sulla barra di navigazione, e il pulsante può essere premuto nuovamente durante MBProgressHUD. Il codice è:MBProgressHud non funziona sulla barra di navigazione

HUD = [[MBProgressHUD alloc] initWithView:self.view]; 
    [self.view addSubview:HUD]; 

    // Regiser for HUD callbacks so we can remove it from the window at the right time 
    HUD.delegate = self; 
    [email protected]"Buscando Bares..."; 
    HUD.dimBackground = YES; 

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

Ho provato a utilizzare:

HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view]; 
     [self.navigationController.view addSubview:HUD]; 

Qualche idea in proposito? Grazie in anticipo.

+1

Xcode? Perché? Usare un IDE diverso farebbe qualche differenza? –

risposta

15

per rendere il MBProgressHUD viene visualizzato sopra tutti i controlli dell'interfaccia utente, tra cui l'UINavigationBar è necessario farlo:

HUD = [[MBProgressHUD alloc] initWithWindow:self.view.window]; 
[self.view.window addSubview:HUD]; 
+0

Sì! Molte grazie! – doxsi

1

@ararog è giusto, ma è anche semplice da fare proprio

_progressHUD = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES];