Arcadian
Arcadian

Reputation: 4350

iPhone/iPad Project xCode

Can I compile the same iPhone source code for iPad?

Upvotes: 1

Views: 1148

Answers (2)

Suresh Varma
Suresh Varma

Reputation: 9740

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...

Upvotes: 0

Jacob Relkin
Jacob Relkin

Reputation: 163228

Yes. This is called a Universal binary.

Upvotes: 8

Related Questions