For the More Curious: Multiple XIB Files

It is possible that you may have a view controller that needs completely different views depending on the type of device that the application is running on. If this is the case, you can create two XIB files – one for each device type.

To get a view controller to load the appropriate XIB file for each device, you simply add a suffix to the filename:

B​N​R​D​e​t​a​i​l​V​i​e​w​C​o​n​t​r​o​l​l​e​r​~​i​p​h​o​n​e​.​x​i​b​
B​N​R​D​e​t​a​i​l​V​i​e​w​C​o​n​t​r​o​l​l​e​r​~​i​p​a​d​.​x​i​b​

By naming XIB files in this way, a view controller will automatically find and load the right file at runtime.

Note that using distinct XIB files is not an alternative to using Auto Layout. You will still ...

Get iOS Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.