Note that there are some explanatory texts on larger screens.

plurals
  1. POUIPageViewController + Auto Layout rotation issue
    text
    copied!<p>I have a UIPageViewController with a simple UIViewController inside of it.</p> <p>If the the UIViewController has no subviews, its view resizes correctly when rotated. (Solid green background).</p> <p><img src="https://i.stack.imgur.com/WRKcX.png" alt="portrait"> <img src="https://i.stack.imgur.com/5mJNr.png" alt="landscape"></p> <p>If the the UIViewController has a subview with a fixed frame, its view resizes correctly when rotated. (Solid green background with yellow square in corner).</p> <p><img src="https://i.stack.imgur.com/Fv3Oy.png" alt="portrait"> <img src="https://i.stack.imgur.com/fVqbf.png" alt="landscape"></p> <p>If the the UIViewController has a subview with its auto layout constraints set to fill its superview, its view no longer resizes correctly when rotated. (Solid yellow background with the UIPageViewController's red background visible). The auto layout code I use is:</p> <pre><code>UIView *v = [[UIView alloc] init]; [v setTranslatesAutoresizingMaskIntoConstraints:NO]; [v setBackgroundColor:[UIColor yellowColor]]; [[self view] addSubview:v]; NSDictionary *viewsDictionary = NSDictionaryOfVariableBindings(v); NSArray *cs = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[v]|" options:0 metrics:nil views:viewsDictionary]; [[self view] addConstraints:cs]; cs = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[v]|" options:0 metrics:nil views:viewsDictionary]; [[self view] addConstraints:cs]; </code></pre> <p><img src="https://i.stack.imgur.com/J3p4t.png" alt="portrait"> <img src="https://i.stack.imgur.com/fheVQ.png" alt="landscape"></p> <p>Why would the auto layout of a subview affect its superview? This only happens if it is contained within a UIPageViewController.</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