You can have iOS automatically load the right xib based on the extension, akin to how Retina graphics work. If your xib is named Awesome
, and you want to convert it into having an iPhone and an iPad version (instead of being shared, rename it such that:
iPhone version:
Awesome~iphone
iPad version:
Awesome~ipad
Then, when you tell iOS to load Awesome
, it'll pick which one to load based on the current platform automagically. No need for if
statements in your code! You can still if you want, but it's not required.
Note: You might need to perform a clean after the rename! Sometimes some files stick around in the build when renamed.