Note that there are some explanatory texts on larger screens.

plurals
  1. POWorkaround for custom UIViewController animations in landscape?
    text
    copied!<p>I have a custom animated UIViewController transition, and it seems that there is a bug in iOS that screws up the layout in landscape orientation. In the main animation method, i'm given a mix of landscape and portrait views. (In portrait the views are all portrait, so no problem.)</p> <pre><code>- (void)animateTransition:(id &lt;UIViewControllerContextTransitioning&gt;)transitionContext; { UIViewController* toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; UIViewController* fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; UIView *containerView = [transitionContext containerView]; // fromViewController.view =&gt; landscape, transform // toViewController.view =&gt; portrait, transform // containerView =&gt; portrait, no transform [containerView addSubview:toViewController.view]; // ...animation... // } </code></pre> <p>I know that the <code>frame</code> property is not reliable when a view has a transform - so I'm guessing this is the root of the problem. In landscape mode, the to/from viewControllers views have a 90 deg clockwise transform [0 -1 1 0]. I've tried using bounds/center to size and position the view, as well removing the transform and then reapplying it, but UIKit fights me and insists on displaying the view as portrait. Annoying!</p> <p>In the screenshot, the dark grey is the UIWindow background, and the red is the added modal view controller which should cover the whole screen.</p> <p><img src="https://i.stack.imgur.com/S5rrQ.png" alt="the red view is in portrait"> </p> <p>Anyone found a workaround?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload