I am making an iOS app that needs to do a little interface rearrangement upon rotation. I am trying to detect this by implementing - (void)orientationChanged:(NSNotification *)note
, but this gives me notifications for when the device is face up or face down.
I want a way to just get notified when the interface changes orientations.
There are several method where you can do that, you can find them in the UIViewController class reference:
– willRotateToInterfaceOrientation:duration:
– willAnimateRotationToInterfaceOrientation:duration:
– didRotateFromInterfaceOrientation:
You could also do it in the viewWillLayoutSubviews
method, but be careful with it, because it is called on the screen appearance too, and whenever you add a subview.
Edit:
Solution now deprecated, see accepted answer.