13

My app has so far just been a portrait-based application. However, I am adding landscape mode to a new version, but have found that my XIB files look shocking when rotated from portrait to landscape. Apparently I need to make a landscape version of each XIB and use some code to change with XIB launches based on what rotation occurs. Am I right? If so, where do I go from here? Are there any Apple sample apps utilising this code?

FYI - My XIB files just have text in them.

Thanks.

3
  • If you set the resizing masks properly for each UI element on the view, it should rotate nicely and keep position/aspect ratio etc.
    – Jasarien
    Mar 23, 2010 at 9:21
  • Yeah the problem is though that some of the text is not centred when it changes orientation - as its not in the right spot.
    – Graeme
    Mar 23, 2010 at 10:16
  • As I said, that'll be because you haven't set the resize masks properly. In interface builder, in the sizing tab of the inspector, there is a section for dynamic resizing and positioning. The red arrows within the square. The animated image to its right shows how the element will behave when resized/rotated with the current setup.
    – Jasarien
    Mar 23, 2010 at 10:42

1 Answer 1

11

If you have a complex view, the automatic resizing may not work well enough. If so, your best bet is to have separate views loaded from separate nibs for each orientation.

To set this up, see here: Easiest way to support multiple orientations? How do I load a custom NIB when the application is in Landscape?

Not the answer you're looking for? Browse other questions tagged or ask your own question.