开发者

How to integrate MBProgressHUD with MGTwitterEngine

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?


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜