0

I've got both working great individually, but when I try to combine them like this:

- (IBAction)showWithLabel:(id)sender 
{
    HUD = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
    [self.checkinsViewController.view addSubview:HUD];
    HUD.delegate = self;
    HUD.labelText = @"Sending tweet";
    [HUD showWhileExecuting:@selector(tweet) onTarget:self withObject:nil animated:YES];
}

- (void)tweet { [_twEngine sendUpdate:@"Test tweet"]; }

I don't get any errors, but the tweet isn't sent If I place:

 [_twEngine sendUpdate:@"Test tweet"];

In the IBAction, it tweets. If I change tweet to sleep, the HUD shows up properly.

Any ideas?

Ahmad Kayyali
  • 8,233
  • 13
  • 49
  • 83
jpsim
  • 14,329
  • 6
  • 51
  • 68

1 Answers1

0

The showHUDAddedTo:animated: and showWhileExecuting: methods are mutually exclusive. You can't use both methods to show the HUD .

Change your initializer to just allocate a HUD and it should work.

HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
Matej Bukovinski
  • 6,152
  • 1
  • 36
  • 36