2014-07-16 16 views
0

일부 항목에는 TableViewController이 있고 나서 filterViewController가 있습니다. 여기에서 필터 데이터는 값에 따라 TableViewController입니다. UISwitch을 사용하여 만듭니다. 어쨌든, 내가 필터링 된 배열로 다시 filterViewController에서 돌아갈 때, SVProgressHUD을 액션에 추가하는 방법을 묻고 싶습니다. 그것들을 필터링하고 tableView에 표시하는 데는 몇 초가 걸립니다. 이미 dispatch_async 시도하고 HUD 표시하지 않습니다. 내가 값을 확인하고 TableViewController로 보내려면 filterViewController의 버튼에 대한 IBAction이 있습니다.SVProgressHUD 다음 ViewController에 표시하는 방법

filterViewController의 작업에 HUD를 추가하면 HUD가 TableViewController에 표시되지 않습니다.

filterViewController.m

-(IBAction)Done:(id)sender{ 

    [self willMoveToParentViewController:nil]; 

    [self.navigationController popViewControllerAnimated:YES]; 


} 

TableViewController.m

- (void)filterController:(filterViewController *)controller didEditConfig:(NSMutableDictionary *)config 
{ 
    [SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeGradient]; 
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 
     // time-consuming task 

     self.konfigg = config; 


     NSSet *filter = [config keysOfEntriesPassingTest: 
         ^BOOL (id key, NSNumber *value, BOOL *stop) { 
          return [value boolValue]; 

         }]; 

     NSLog(@"filtered keys: %@ (%lu of %lu)", filter, (unsigned long)filter.count, (unsigned long)config.count); 

     PFQuery *query = [PFQuery queryWithClassName:@"Class"]; 
     [query addDescendingOrder:@"createdAt"]; 
     [query whereKey:@"eventDay" containedIn:[filter allObjects]]; 

     [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { 

      if (!error) { 
       self.itemss = [objects mutableCopy]; 
       [self.MainTable reloadData]; 

       NSLog(@"Got filtered results %@ (%lu)", objects, (unsigned long)objects.count); 
      }} 
     ]; 
     dispatch_async(dispatch_get_main_queue(), ^{ 
      [SVProgressHUD dismiss]; 
     }); 
    }); 

} 

답변

0

는 알았어요. TableViewController의 필터 용으로 BOOL 만 만들었습니다. 내가 생각했던 것보다 쉬웠다.