Reputation: 1378
I am trying to do simple right to left slide up custom presentation animation but facing issues while dismissing (left to right) it, as modal viewcontroller does the animation smoothly but the container view stays for a moment. How to avoid that?
In my custom animation presenting viewcontroller stays at its place only presented modal view controller animates.
While presenting (Right to left) we add presented viewcontroller to a container something like this. But while dismissing the container stays for a while and then disappears.
UIViewController *fromViewController = (UIViewController *)[transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
UIViewController *toViewController = (UIViewController *)[transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
//Adding the subviews
UIView *containerView = [transitionContext containerView];
[containerView addSubview:toViewController.view];
I tried putting this.
containerView.backgrounColor = [UIColor ClearColor]
But never worked it's still shows that white background. While if I set it to other color that color appears while dismissing for a moment.
Upvotes: 1
Views: 534
Reputation: 1378
Ah got it! I forget to add this line
viewcontroller.modalPresentationStyle = UIModalPresentationCustom;
that's why this is happening.
Upvotes: 1