Search code examples
mbprogresshudmknetworkkit

How to use MBProgressHUD with MKNetworkKit?


Im using MKNetworkKit with protocols and delegates to send service calls and get json response. Now I want to implement MBProgressHUD to show a busy indicator while the data is being fetched and loaded on the UITable View.

I send the request in viewDidLoad;

            - (void)viewDidLoad
            {
                [super viewDidLoad];
                // Do any additional setup after loading the view from its nib.

                [[DataEngine sharedEngine]setFetchUserDataDelegate:self];
                [[DataEngine sharedEngine]fetchUserData:@"1"]; 
             }

Where Data Engine is my singleton class where I declared the fetchUserData Method.

I have included the required files i-e; MBProgressHUD.h & MBProgressHUD.m in my project.

Now which code I should write to start and stop the busy indicator and where should I write that code?

Thanks


Solution

  • 1) Download project files from Here: https://github.com/jdg/MBProgressHUD 2) Include MBProgressHUD.h & MBProgressHUD.m files into your project directory. 3) Create an instance variable like: MBProgressHUD *progressHUD in your .h file. 4) In .m file, write following code;

    progressHUD = [[MBProgressHUD alloc]initWithView:self.view];
    [progressHUD show:YES];
    [self.view addSubView:progressHUD];
    

    5) To stop the progress indicator write;

    [progressHUD hide:YES];