title: collectionView not reloading in parentviewcontroller on removal of childviewcontroller
body: <p>Any one know how to reload <code>collectionView</code> in <code>parentViewController</code> when removing <code>childViewController</code>.</p>
  
  <p>Here, I am processing on click of button adding <code>childViewController</code> and on click of that <code>childViewController</code> I am getting data and that data will transferred to <code>parentViewController</code> after that child view get's remove from <code>parentViewController</code>. </p>
  
  <p>I am getting data from <code>childViewController</code>, also reloading collection view.</p>
  
  <pre><code>dispatch_async(dispatch_get_main_queue(),^{
      [self.view layoutIfNeeded];
  
      [self.collectionViewcellItem layoutIfNeeded];
      [self.collectionViewcellItem reloadData];
  });
  </code></pre>
  
  <p>but, no effect of reloading here seen.
  means not able to change parentviewconroller view after removal of <code>childViewController</code>.</p>
  
  <p>Thank you 
  Waiting for the answer and yes I am doing it in objective c.</p>
  
  <p><code>parentViewController</code> file.</p>
  
  <pre><code>[self.view addSubview:filterMenuVC.view];
  filterMenuVC.view.backgroundColor = [UIColor clearColor];
  [self addChildViewController:filterMenuVC];
  
  [self.view addSubview:filterMenuVC.view];
  
  [self animationSideFilterMenuBarOpen];
  
  [filterMenuVC didMoveToParentViewController:self];
  </code></pre>
  
  <p><code>childViewController</code> file</p>
  
  <pre><code>-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  {
  
  
  
      NSLog(@"%@",[NSString stringWithFormat:@"%ld",(long)indexPath.row]);
  
      //   // [wel animationSideFilterMenuBarClose];
  
      UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
      int categoryId = (int)cell.textLabel.tag;
  
      [self animationSideMainMenuBarClose:categoryId];
  
  
  
  }
  -(void)animationSideMainMenuBarClose:(int)categoryId{
  
      CGFloat width = [UIScreen mainScreen].bounds.size.width;
  
      self.view.frame = CGRectMake(width - self.view.frame.size.width, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height);
  
  
      [UIView animateWithDuration:0.5 animations:^{
          self.view.frame = CGRectMake(width, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height);
  
      }
                       completion:^(BOOL finished){
  
                           [self.view removeFromSuperview];
                           self.view = nil;
  
  
                           NSLog(@"category id Filter: %d",categoryId);
                           BOOL boolresponse = [wel getUserWork:categoryId];
                           if (boolresponse == NO) {
                               UIAlertController * alert = [UIAlertController
                                                            alertControllerWithTitle:@""
                                                            message:@"No internet connection"
                                                            preferredStyle:UIAlertControllerStyleAlert];
  
                               UIAlertAction *okButton = [UIAlertAction
                                                          actionWithTitle:@"OK"
                                                          style:UIAlertActionStyleDefault
                                                          handler:^(UIAlertAction * action) {
  
                                                          }];
  
  
                               [alert addAction:okButton];
  
  
                               [self presentViewController:alert animated:YES completion:nil];
  
                           }
                       }];
  
  
  }
  </code></pre>
  
  <p>here, <code>BOOL boolresponse = [wel getUserWork:categoryId];</code> getUserWork is the function in parentViewController, I call that and removing the <code>childViewController</code>. get correct data but not able to reload collectionView.</p>
  
  <p><code>parentViewFunction</code> which I am calling.</p>
  
  <pre><code>  -(BOOL)getUserWork:(int)catergoryId{
      appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
  
      [self dismissViewControllerAnimated:true completion:^{
          //do whatever you do here
          [self.collectionViewcellItem reloadData];
      }];
  
  
      categoryIdStart = catergoryId;
  
      Reachability *r = [[Reachability alloc]init];
  
      if(r.currentReachabilityStatus != NotReachable)  {
          return NO;
      }
      else
      {
  
  
          [SVProgressHUD show];
          [SVProgressHUD setStatus:@"Loading..."];
          [SVProgressHUD setRingRadius:20];
          [SVProgressHUD setRingThickness:10];
          [SVProgressHUD setBorderColor:[UIColor orangeColor]];
          [SVProgressHUD setBorderWidth:0.5];
          [SVProgressHUD setForegroundColor:[UIColor orangeColor]];
  
          NSLog(@"id category: %d",categoryIdStart);
          NSDictionary *params = [[NSDictionary alloc] initWithObjectsAndKeys:[appDelegate.UserDic valueForKey:@"token"],@"token",[appDelegate.UserDic valueForKey:@"id"],@"id_user",[NSString stringWithFormat:@"%d",categoryIdStart],@"id_category",nil];
  
          NSMutableArray *postArray = [NSMutableArray array];
          [params enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *obj, BOOL *stop) {
              [postArray addObject:[NSString stringWithFormat:@"%@=%@", key, [apiCall percentEscapeString:obj]]];
          }];
          NSString *postString = [postArray componentsJoinedByString:@"&amp;"];
  
          [apiCall apiType:@"xyzzy" pD:postString dataRetrive:^(NSDictionary *dictionary){
  
              int status = [[dictionary  valueForKey:@"status"] intValue];
              if (status == 0) {
  
                  [SVProgressHUD dismiss];
                  dispatch_async(dispatch_get_main_queue(),^{
                      UIAlertController * alert = [UIAlertController
                                                   alertControllerWithTitle:@""
                                                   message:[dictionary valueForKey:@"msg"]
                                                   preferredStyle:UIAlertControllerStyleAlert];
  
                      UIAlertAction *okButton = [UIAlertAction
                                                 actionWithTitle:@"OK"
                                                 style:UIAlertActionStyleDefault
                                                 handler:^(UIAlertAction * action) {
  
                                                 }];
  
  
                      [alert addAction:okButton];
  
  
                      [self presentViewController:alert animated:YES completion:nil];
  
                  });
              }
              else{
  
                  [SVProgressHUD dismiss];
  
  
  
                      [cacheImage removeAllObjects];
  
                      dic = [dictionary valueForKey:@"data"];
  
                      NSLog(@"Category detail: %@ %lu",dic,(unsigned long)dic.count);
  
  
                      NSLog(@"image category %@ :",[dic valueForKey:@"category_name"]);
  
  
  
  
                  dispatch_async(dispatch_get_main_queue(),^{
  
  
  
                      [self.view layoutIfNeeded];
  
                       [self.collectionViewcellItem layoutIfNeeded];
                      [self.collectionViewcellItem reloadData];
  
  
                          [self viewWillAppear:true];
  
                  });
  
  
              }
          }];
  
          return YES;
      }
  
  
  
  
  }
  </code></pre>