wkerswell

add sub view from app delegate

Nov 16th, 2012
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     // If date is greater than refresh then update the data
  2.     if ([timeNow timeIntervalSinceDate:date] > refreshTime)
  3.     {
  4.         NSLog(@"Data is too old !!");
  5.         dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
  6.             // Show the HUD in the main tread
  7.             dispatch_async(dispatch_get_main_queue(), ^{
  8.                 // No need to hod onto (retain)
  9.                 MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.navigationControllerview animated:YES];
  10.                 hud.labelText = @"Loading";
  11.             });
  12.            
  13.             // Do a taks in the background
  14.             NSLog(@"doing stuff in the bg while loading is displayed");
  15.             sleep(3);
  16.            
  17.             // Hide the HUD in the main tread
  18.             dispatch_async(dispatch_get_main_queue(), ^{
  19.                 [MBProgressHUD hideHUDForView:self.navigationController.view animated:YES];
  20.             });
  21.         });
  22.        
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment