tags:

views:

78

answers:

2

Can I compile the same iPhone source code for iPad?

+6  A: 

Yes. This is called a Universal binary.

Jacob Relkin
A: 

Yes you can do so.

(If you simply want to run iPhone code on iPad)

Then When you select the base sdk as 3.2 it will run on iPad with a small 2x button at the right bottom Clicking on which will zoom the whole application as per the iPad screen but the images used will be blur.

(If you want it to make the code for both)

All you have to do is to set the Target Family in Build as iPhone/iPad instead of iPhone. and set the frames as per iPad by certain condition recognizing you are running on iPhone or iPad.

That can be done by below set of code

BOOL kIS_IPAD;//GLOABAL VARIABLE

#ifdef UI_USER_INTERFACE_IDIOM()
#define IS_IPAD() (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#else
#define IS_IPAD() (false)
#endif


    if (IS_IPAD()) {
        kIsIPAD=YES;
    }
    else {
        kIsIPAD=NO;
    }

hAPPY cODING...

Suriya