Open dulgan opened 10 years ago
Hi,
I had same issue, so I found workaround.
Replace - (void)animateTransition:(id
(void)animateTransition:(id
UIViewController fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; UIViewController toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; UIView toView = toVC.view; UIView fromView = fromVC.view; fromVC.view.backgroundColor = [UIColor colorWithPatternImage:[self imageWithView:fromVC.view]];
[self animateTransition:transitionContext fromVC:fromVC toVC:toVC fromView:fromView toView:toView]; }
(UIImage )imageWithView:(UIView )view { UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0); [view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage * img = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();
return img; }
Hi,
I followed your tutorials and use your VCTransitionLibrary in my app, here is my App structure : 1) A NavigationController is the root of the application (using your tutorial code) 2) MyRootViewController is the root view controller in the NavigationController 3) MyPushedViewController is pushed or poped with animations by MyRootViewController
Everything is fine with animations, but a problem occur in the following configuration : 1) MyRootViewController is on screen, (the only ViewController in the NavigationController stack) 2) App goes to background 3) App goes to foreground : 3.1) applicationWillEnterForeground fires a notification to NSNotificationCenter defaultCenter 3.2) MyRootViewController listen to this notification and execute the following code : // pop to root [self.navigationController popToRootViewControllerAnimated:NO]; // instantiate new view controller MyPushedViewController *mpvc = [self.storyboard instantiateViewControllerWithIdentifier:@"MyPushedViewController"]; // mpvc init code... // ... // push the new view controller [self.navigationController pushViewController:ncvc animated:NO]; 4) MyPushedViewController is displayed without any problem 5) User swipe to trigger a pop, and MyRootViewController is black, not appearing in animation (but it's viewWillAppear is triggered).
I need to use animated:NO because I don't want the app to show anything else than MyPushedViewController when it's back to foreground. The is no problem in any other configuration : animated:YES display the animation fine when MyPushedViewController was on screen, it's also working fine
Do you have any clue about this problem ?
Thanks for your work and your time !