I (hopefully) watched all the relevant WWDC2014 session videos and read the docs, so this question is mostly to confirm my suspicions, but please educate me.
What I want
After some more digging in the docs I have finally found something useable. The UIContentContainer
protocol defines willTransitionToTraitCollection(:withTransitionCoordinator:)
, and that method's first parameter (a UITraitCollection
) contains horizontal and vertical size classes as well as a UIUserInterfaceIdiom
(that can be used to know whether the app is running on a iPhone or iPad, although size classes should be used for most things).
Additionally, since iOS 8 hides the status bar in landscape view, traitCollectionDidChange(previousTraitCollection:)
is the corresponding method that gets called after the change happened, so the value of UIApplication.sharedApplication().statusBarHidden
has changed when this method is called. Can be useful for UIScrollView
's contentInset
for example.
Lastly, if you need the exact screen sizes (in points, of course, but the above mentioned trait collection also knows about pixel density), there is viewWillTransitionToSize(:withTransitionCoordinator:)
.
Hope this helps someone else as well.