tags:

views:

96

answers:

1

I want to make an universal build, but I create my UI entirely programmatically.

1) Can I add my different view controller classes to the device-specific resources directories? Or must classes be shared along both devices?

2) If I must share the classes along both devices, what's the safest way to conditionally load classA or classB depending on if it's an iPhone or iPad device?

A: 

On every view controller you can do a device check to see which device is running your app and accordingly build your UI. ie, use only one set of view controllers and in the *.m files, in an if-else loop, build your UI accordingly.

Refer to this post to do device checks: http://stackoverflow.com/questions/448162/determine-device-iphone-ipod-touch-with-iphone-sdk

PS: In your if-else, do an if(iPad){} else{} check as a best practice, since, often times than not, people forget to check for iPod Touch if they do if(iPhone){}else{}

Siddharth Iyer
By the way this is tried and tested and it works, since I have an app on the app store using this technique :)
Siddharth Iyer