2013-04-17 34 views
7

Tôi có một buttono trong mục điều hướng mà hành động là BUTTON_ACTION. Bằng cách nhấn nó, MBProgressHUD được kích hoạt và tác vụ hành động. nhưng "dimBackground" làm cho "ẩn" các scrren, doe không hoạt động trên thanh điều hướng, và nút có thể được nhấn một lần nữa trong MBProgressHUD. Mã này là:MBProgressHud không hoạt động trên thanh điều hướng

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]; 

Tôi tryed sử dụng:

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

Bất kỳ ý tưởng về điều đó? cảm ơn trước.

+1

Xcode? Tại sao? Việc sử dụng một IDE khác có tạo nên sự khác biệt nào không? –

Trả lời

15

Để thực hiện MBProgressHUD được hiển thị trên tất cả các điều khiển giao diện người dùng bao gồm UINavigationBar bạn phải làm điều này:

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

Có! Cảm ơn rất nhiều! – doxsi

1

@ararog là đúng, nhưng nó cũng đơn giản chỉ làm

_progressHUD = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES]; 
Các vấn đề liên quan