I'm trying to figure out how to use UITraitCollection
programatically, but I find it difficult to make sense of it. I'm developing for an iPad retina, in iOS 8.
println(self.traitCollection)
returns the following output:
<UITraitCollection: 0x10df4c7f0; _UITraitNameUserInterfaceIdiom = Pad,
_UITraitNameDisplayScale = 2.000000, _UITraitNameHorizontalSizeClass = Regular,
_UITraitNameVerticalSizeClass = Regular, _UITraitNameTouchLevel = 0,
_UITraitNameInteractionModel = 1>
Which is pretty straight forward. But when I then rotate the screen, I get the exact same output. I.e., same vertical size class, and same horizontal size class.
So my question is, do I need to specify the size class I want for each device orientation (as far as I can see, the size classes are read-only properties!) or am I missing something obvious? In the example given in the 'What's new in Cocoa-Touch' talk on the WWDC 2014 video site, he uses the iPhone as an example, which has different vertical / horizontal size classes for each device orientation.
How would you go about this?
rotated device
is gone in iOS 8, when you rotate, your VC will simply receive a bounds change (on iPad). If you really want to detect a rotation, you can check that the height & width swapped. – Aromatic