Class 从另一个类调用hide后MBProgressHud未隐藏

Class 从另一个类调用hide后MBProgressHud未隐藏,class,mbprogresshud,Class,Mbprogresshud,我有一个名为GetInfoViewController的ViewController。基本上,它接受用户输入,然后将输入发送到NSObject类ServerConnection。ServerConnection发出nsurlconnection请求,完成后我希望MBProgressHUD隐藏 GetInfoViewController - (IBAction)go:(id)sender{ ServerConnection *serverConnection = [[Server

我有一个名为GetInfoViewController的ViewController。基本上,它接受用户输入,然后将输入发送到NSObject类ServerConnection。ServerConnection发出nsurlconnection请求,完成后我希望MBProgressHUD隐藏

GetInfoViewController

    - (IBAction)go:(id)sender{

    ServerConnection *serverConnection = [[ServerConnection alloc]init];

    MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    HUD.labelText = @"Searching...";

// here the progressHUD shows normally, and the yelpConnectionMethod is successful in retrieving the result.

    [serverConnection yelpConnectionMethod];


}


-(void)endProgressHUD{
    NSLog(@"end called");


    [MBProgressHUD hideHUDForView:self.view animated:YES];
}
服务器连接.h

我不打算把所有的nsurlconnection代码都放进去,因为我认为它并不适用。。但是如果你想要的话,我可以把它寄出去

唯一重要的是: (在完成所有连接后调用此函数。)

我成功地调用了getInfoViewController的endProgressHUD方法,因为它记录了“EndCalled”。但是,进度hud保持旋转且不隐藏


任何输入都会有帮助。

在显示HUD时尝试此方法

-(void)显示在目标上执行:(SEL)方法时:(id)对象为:(id)对象已设置动画:(BOOL)已设置动画


这是一种MBProgressHUD方法-
选择器
应该是
yelpConnectionMethod
并以
serverConnection
为目标,object=
nil
,动画取决于您:)

在显示HUD-
-(void)show时尝试此方法,同时执行:(SEL)target:(id)target with object:(id)object animated:(BOOL)已设置动画;
。这是MBProgressHUD的一种方法-选择器应为
yelpConnectionMethod
,目标为
serverConnection
,对象为零并设置动画取决于您:)和。。。看来你又一次拯救了这一天。LOL感谢您的帮助我将其作为答案发布:)
GetInfoViewController *getinfoVC = [[GetInfoViewController alloc]init];
[getinfoVC endProgressHUD];