Use of MBProgressHUD Globally + make it singleton

后端 未结 9 1204
时光说笑
时光说笑 2020-12-23 02:06

In my Project, each of the user interaction events make a network call (Which is TCP, not HTTP). I need Activity Indicator to be global to show from a rando

9条回答
  •  旧时难觅i
    2020-12-23 02:40

    Add these two methods to show or hide loader in your singleton class

    - (void)startLoaderWithText:(NSString *)title View:(UIView *)view{
        progressHud = [MBProgressHUD showHUDAddedTo:view animated:YES];
        progressHud.labelText = title;
        progressHud.activityIndicatorColor = [UIColor grayColor];
        progressHud.color = [UIColor clearColor];
        [progressHud show:YES];
    }
    
    - (void)stopLoader{
        [progressHud hide:YES];
    }
    

提交回复
热议问题