I am attempting to make a modal custom transition where I need the frame the first cell of a tableview in the view controller I am transitioning TO.
When I put breakpoints in animateTransition:transitionContext
after the following code:
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
UITableViewCell *cell = [toViewController.tableView cellForRowAtIndexPath:indexPath];
I see that the tableview is nil, along with all the other controls on the page.
After much searching I was able to find a similar question which suggested using the following code when pushing a vc:
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.02 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self presentViewController:detailViewController animated:YES completion:nil];
});
But that doesn't work, the tableview and all other page elements are nil in animateTransition:transitionContext
I understand that I am getting nil because at this point in the view lifecycle, tableview has not been calculated yet, but isn't there some way to reference to a tableview cell in a custom transition?