Why is UIKit resetting the UIViewController's UIView frame to "full screen" during a custom transition?
Asked Answered
P

0

10

I'm using a custom transition to slide a view controller 2/3 off screen when - presentViewController:animated:completion: is called and slide it back again when dismissViewControllerAnimated:completion: is called.

I'm also using UIPercentDrivenInteractiveTransition attached to a UIScreenEdgePanGestureRecognizer to slide the view controller.

All works well, except when calling dismissViewControllerAnimated:completion:, before:

- (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionContext

is called the frame of the view controller slid off screen is set to:

(0 0; 320 568)

causing it to momentarily "flash" before the animation runs and it slides from 2/3 off screen back to full screen.

By subclassing the UIView on the View Controller I can set a break point in -setFrame it shows the method:

[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:animation:]

is calling -setFrame with (0 0; 320 568).

Why is it doing this? How can I prevent it from setting the frame before the animation starts?

Polyphagia answered 6/11, 2013 at 11:36 Comment(1)
did you find a solution? I came up with the same problem. It looks like UIKit it applying the initial frame found in the transitionContext before executing any lines of code in the animateTransition method.Heine

© 2022 - 2024 — McMap. All rights reserved.