How to load different XIBs for different device orientations for same viewcontroller?

Posted by Jaanus on Stack Overflow See other posts from Stack Overflow or by Jaanus
Published on 2010-04-20T21:21:01Z Indexed on 2010/04/20 21:23 UTC
Read the original article Hit count: 352

The documentation says that if I want to support both portrait and landscape, I basically have two ways of doing that:

  1. Set up the viewcontroller's view so that the subviews autoresize correctly and make smaller changes programmatically at runtime
  2. If the changes are more substantial, create an alternative landscape interface and push/pop the alternative modal viewcontroller at runtime

I would like to present the info where the layout is substantially different, but logic is the same. Ideally, I would load another XIB for the same viewcontroller, but it does not seem to be an option.

Sounds like #2 is what I need to do, but my problem with that is that it sounds like it would use the standard modalviewcontroller animations that are nothing like the device rotation animation. (Of course, being the lazywebber that I am, I did not test this hypothesis.)

So, how do I load an alternative layout for landscape with the same viewcontroller but different XIB? Should I use the method #2 above and is the rotation animation natural? Or is there some other way?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiviewcontroller