任何人都有关于如何使用XCode 4.2创建通用应用程序的教程? [英] Anyone has a tutorial on how to create Universal app with XCode 4.2?

查看:80
本文介绍了任何人都有关于如何使用XCode 4.2创建通用应用程序的教程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看起来XCode 4.2的内容发生了变化,我没有看到任何关于如何使用XCode 4.2创建通用应用程序的指南/教程。任何人都知道一个或写一个?

It looks like things changed with XCode 4.2 and I did not see any guide/tutorial on how to create a Universal app with XCode 4.2. Anyone knows one or wrote one?

注意:我不是在谈论如何选择你的项目是Universal,我在谈论Hello World教程。

Note: I'm not talking about how to select your project to be Universal, I'm talking about a Hello World tutorial.

谢谢,

推荐答案

如果你真的想要一个简单的来源,可编辑为将$ Hello World 写入控制台的通用应用程序,具体取决于所使用的设备,这里有一个小小的片段。

In case you actually wanted a plain source, compilable as a universal app that writes Hello World into the console, depending on the device in use, here comes a tiny snippet for you.


main.m

main.m



#import <UIKit/UIKit.h>

int main(int argc, char *argv[])
{
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    {
        printf("hello world, from my iPad");
    }
    else 
    {
        printf("hello world, from my iPhone or iPod");
    }
    return 0;
}

在您的应用的构建设置中,您必须选择:

Within the build settings of your app, you will have to select:

TARGETED_DEVICE_FAMILY = 1,2

喜欢这样:

Like this:

这篇关于任何人都有关于如何使用XCode 4.2创建通用应用程序的教程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆