views:

30

answers:

1

I'm building a custom view inside of Interface Builder that has buttons with image backgrounds. The buttons extend to each side of the screen, so I'll need two images for each layout (Portrait and Landscape). As such, do I need to have two different NIB files for each layout (Portrait and Landscape), or is there a way to just use one NIB file and specify which images to use for the buttons depending on which layout the app is running in?

Thanks so much in advance for all your help!

+2  A: 

You should use 1 nib file. Give each control the correct autoresizingMask to ensure they scale and position correctly when the orientation changes.

Changing the images should be done in the view controller by overriding one of these methods:

willRotateToInterfaceOrientation:duration:
willAnimateRotationToInterfaceOrientation:duration:
didRotateFromInterfaceOrientation:

More info about these methods are in the docs.

Rengers
thanks, rengers!
BeachRunnerJoe