Reputation: 2094
I want to describe an issue (and its corresponding solution) I was having with Size Classes.
For a UIViewController and iPhone-only environment, I want to have a different layout for landscape and portrait. I have the corresponding designs on Interface Builder using Size Classes. However, when running the application on the simulator, I always get the portrait layout regardless of the device orientation.
I have tried 2 different approaches:
In both cases, everything looks good in the Preview feature of Interface Builder for all iPhone devices and orientations but on the simulator I always see the portrait layout regardless of device orientation.
I am using Xcode 7.2 and I have tried all iPhone Simulators on both iOS 8.4 and 9.2. No warnings about autolayout constraints are seen on any of the Size Classes.
Upvotes: 0
Views: 469
Reputation: 2094
The problem turned out to be unrelated to the usage of Size Classes. I didn’t notice I was getting this warning when presenting the problematic view controller: Presenting view controllers on detached view controllers is discouraged
Fixing that issue and removing that warning made everything work as expected.
Upvotes: 0