Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // If date is greater than refresh then update the data
- if ([timeNow timeIntervalSinceDate:date] > refreshTime)
- {
- NSLog(@"Data is too old !!");
- dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
- // Show the HUD in the main tread
- dispatch_async(dispatch_get_main_queue(), ^{
- // No need to hod onto (retain)
- MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.navigationControllerview animated:YES];
- hud.labelText = @"Loading";
- });
- // Do a taks in the background
- NSLog(@"doing stuff in the bg while loading is displayed");
- sleep(3);
- // Hide the HUD in the main tread
- dispatch_async(dispatch_get_main_queue(), ^{
- [MBProgressHUD hideHUDForView:self.navigationController.view animated:YES];
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment