Sometimes you may want to display a different view in landscape and portrait mode. A good example is Apple’s Calculator: it switches from normal in portrait mode to scientific in landscape mode.
There are several reasons you may want to do so:
- Your view is very complex and it’s impossible or very difficult to reuse it in landscape mode.
- You wish to use the extra horizontal space on the landscape mode to display new features. Apple’s Calculator app is a good example.
- You are using a sub view that takes up too much space in landscape, such as a UIPickerView.
FRRRotatingViewController will handle the VC switching _automagically_ for you: just initialize it with 2 FRRViewControllers
and it will do the magic for you.
[crayon lang="Objective C"] -(FRRRotatingViewController *) initWithLandscapeViewController: (FRRViewController *) landscape andPortraitViewController: (FRRViewController *) portrait; [/crayon]
In the images below, a FRRRotatingController switches between two simple VCs that display an image:
Both sub view controllers can be delegated and be notified when the FRRRotatingViewController switches sub view
The source code is available at GitHub.