0

Basically, I've got a Collection View who's cell.contentView adds a ViewController's view in willDisplayCell of collectionView as below:

-(void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {
    UIViewController *vc = [self.viewControllerArray objectAtIndex:indexPath.row];
   [self displayContentController:vc inView:cell];
}

- (void)displayContentController:(UIViewController *)viewController inView: (UICollectionViewCell *)cell {
   [self addChildViewController:viewController];
   viewController.view.frame = cell.bounds;
   [cell.contentView addSubview:viewController.view];
   [viewController didMoveToParentViewController:self];
}

Now, this ViewController has a tableView. In the didSelectRowAtIndexpath of the tableview, i'm pushing a New ViewController.

Surprisingly, the viewDidLoad and viewDidLayoutSubviews of the pushed ViewController is called but the viewWillAppear is not called.

I also receive the following warning in the console Unbalanced calls to begin/end appearance transitions for <viewController Having collection View>

I'm not sure what wrong I am doing.

Even tried this with cellForRowAtIndexPath but not luck.

digit
  • 4,479
  • 3
  • 24
  • 43
Prabhav
  • 969
  • 7
  • 8

1 Answers1

0

The ViewController needs to be added to the UINavigationController stack!

ystack
  • 1,785
  • 12
  • 23