MBProgressHUD blocks user interaction with table view

I have a uitableview that downloads data from the internet, and during this period im displays MBProgressHUD. But the problem is that the user cannot touch anything, including the previous page, before loading the table. Here is my code in two different classes:

//PROBLEM METHOD 1 - (void)viewDidLoad { [super viewDidLoad]; [tableEtkinlikler reloadData]; MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; HUD.labelText = @"Açılıyor..."; HUD.userInteractionEnabled = NO; [self performSelector:@selector(loadEtkinliklerTitlesAndImages) withObject:nil afterDelay:0]; tableEtkinlikler.dataSource = self; tableEtkinlikler.delegate = self; } 

I have the same problem with the button also .. im loading data from the internet into it ..

 //PROBLEM METHOD 2 - (IBAction)AktivitelerButtonClicked:(UIButton *)sender { MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; HUD.labelText = @"Açılıyor..."; HUD.userInteractionEnabled = NO; [self performSelector:@selector(openAktivitelerWindow) withObject:nil afterDelay:0]; } 
+6
source share
1 answer

I believe this is the point of MBProgressHUD , it gives you the opportunity to show the HUD when your tasks are complete, as soon as your tasks are completed, you release it so that the user can interact with the completed data.

However, in some cases, loading data takes so much time, so you can let the user decide to continue, choose another option, or just go back

in your code this HUD.userInteractionEnabled = NO; should work, but the problem may be that showHUDAddedTo:self.view you are not using the highest view in the view hierarchy.

Try using this:

 - (IBAction)showSimple:(id)sender { // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view]; [self.navigationController.view addSubview:HUD]; HUD.userInteractionEnabled = NO; // Regiser for HUD callbacks so we can remove it from the window at the right time HUD.delegate = self; // Show the HUD while the provided method executes in a new thread [HUD showWhileExecuting:@selector(loadEtkinliklerTitlesAndImages) onTarget:self withObject:nil animated:YES]; } 
+10
source

All Articles