MBProgressHUD显示并单击按钮

时间:2015-09-01 10:09:39

标签: ios mbprogresshud

MBProgressHUD显示进度时,我的视图用户界面禁用,因此用户无法单击按钮。

但是当MBProgressHUD正在进行时,如果你点击按钮没有按钮动作调用。但在完成MBProgressHUD完成后,该按钮会自动点击呼叫。

我怎么能阻止它。

2 个答案:

答案 0 :(得分:0)

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

您可以根据需要将属性更改为userInteractionEnabled

答案 1 :(得分:0)

试试这个:

- (void) hideProgressHUD
{

        //this for loop will remove all progress hud from window, if user accept multiple notification one by one then for removing hud from screen this for loop is added.

        for (UIView *v in self.window.subviews) {
            if ([v isKindOfClass:[MBProgressHUD class]]) {
                MBProgressHUD *hudV = (MBProgressHUD *)v;
                [hudV hide:YES];
                [hudV removeFromSuperview];

            }
        }

        [hudActivity hide:YES];
        [hudActivity removeFromSuperview];
        hudActivity=nil;
    }