2011-05-10 57 views
0
整合

我有兩個偉大的工作,獨立,但是當我嘗試給他們這樣的組合:如何MBProgressHUD與MGTwitterEngine

- (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"]; } 

我沒有得到任何錯誤,但不發送鳴叫如果我的地方:

[_twEngine sendUpdate:@"Test tweet"]; 

在IBAction,它鳴叫。如果我將tweet更改爲睡眠狀態,則HUD會正常顯示。

任何想法?

回答

0

showHUDAddedTo:animated:showWhileExecuting:方法是相互排斥的。您不能使用這兩種方法來顯示HUD。

更改您的初始值設定爲剛分配HUD,它應該工作。

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