确定ipad设备 [英] determine ipad device

查看:110
本文介绍了确定ipad设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为iphone和ipad编写通用应用程序。如何确定设备是否为iPad。我使用此链接来确定iPhone类型(3G,3GS)。

I am writing a universal app for both iphone and ipad. How do I determine if the device is an iPad. I have used this link to determine the iPhone type (3G, 3GS).

使用iPhone SDK确定设备(iPhone,iPod Touch)

推荐答案

布拉德的解决方案是绝对正确的。如果您正在构建一个通用应用程序,该应用程序设计为在具有较旧操作系统的iPhone以及最新的iPad和iPhone上运行,您可能需要添加此代码以捕获未定义成语的情况。

Brad's solution is absolutely right. If you're building a universal app designed to run on iPhones with older OS along with up-to-date iPads and iPhones, you might want to add this code to catch situations where the idiom is not defined.

// If iPhoneOS is 3.2 or greater then __IPHONE_3_2 will be defined
#ifndef __IPHONE_3_2    

typedef enum {
    UIUserInterfaceIdiomPhone,           // iPhone and iPod touch
    UIUserInterfaceIdiomPad,             // iPad
} UIUserInterfaceIdiom;

#define UI_USER_INTERFACE_IDIOM() UIUserInterfaceIdiomPhone

#endif // ifndef __IPHONE_3_2

这篇关于确定ipad设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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