I am using Swift and I want to be able to load a UIViewController when I rotate to landscape, can anyone point me in the right direction?
I Can't find anything online and a little bit confused by the documentation.
I am using Swift and I want to be able to load a UIViewController when I rotate to landscape, can anyone point me in the right direction?
I Can't find anything online and a little bit confused by the documentation.
I use
UIUserInterfaceSizeClass
to detect a orientation changed in aUIViewController
class just like that:Full working implementation of how to detect orientation change in Swift 3.0.
I chose to use this implementation because phone orientations of
face up
andface down
were important to me, and I wanted the view to change only once I knew the orientation was in the specified position.The important pieces to note are:
unknown
orientation at times.Hope someone finds this helpful.