简体   繁体   English

iPhone / iPad项目xCode

[英]iPhone/iPad Project xCode

我可以为iPad编译相同的iPhone源代码吗?

Yes. 是。 This is called a Universal binary . 这称为通用二进制文件

Yes you can do so. 是的,您可以这样做。

(If you simply want to run iPhone code on iPad) (如果您只是想在iPad上运行iPhone代码)

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. 然后,当您选择基本sdk作为3.2时,它将在iPad上运行,并在右下角有一个2x的小按钮。单击该按钮将按照iPad屏幕缩放整个应用程序,但所使用的图像将变得模糊。

(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 . 您要做的就是将Build中的Target Family设置为iPhone/iPad而不是iPhone and set the frames as per iPad by certain condition recognizing you are running on iPhone or iPad. 并在一定条件下根据iPad设置框架,以识别您正在iPhone或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... 令人愉快的...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM