UI_USER_INTERFACE_IDIOM是否可与目标设备系列一起使用 [英] Does UI_USER_INTERFACE_IDIOM work with Targeted Device Family

查看:64
本文介绍了UI_USER_INTERFACE_IDIOM是否可与目标设备系列一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我目前正在将UI_USER_INTERFACE_IDIOM与[[UIDevice currentDevice]模型]结合使用,以检查我是否在iPhone,iPod或iPad上.我发现在iPad模拟器3.2中,UI_USER_INTERFACE_IDIOM仍评估为UIUserInterfaceIdiomPhone(iPhone).

So I'm currently using UI_USER_INTERFACE_IDIOM in conjunction with [[UIDevice currentDevice] model] to check if I'm on an iPhone, iPod or iPad. What I've found is that in the iPad simulator 3.2, UI_USER_INTERFACE_IDIOM still evaluates to UIUserInterfaceIdiomPhone (iPhone).

我想知道这是否与我的目标设备系列"设置有关.我只针对我的应用程序使用iPhone(我不想制作具有缩放视图的通用应用程序).但是,我支持3.2 SDK,因此我仍然希望拥有iPad的用户能够运行我的iPhone应用程序. 即使我以iPhone为目标,UI_USER_INTERFACE_IDIOM在iPad上是否可以正确评估?

I'm wondering if this has something to do with my Targeted Device Family setting. I'm only targeting iPhone for my App (I don't want to make a universal app with scaling views). However, I support the 3.2 SDK so I still want users that have an iPad to be able to run my iPhone app. Will UI_USER_INTERFACE_IDIOM evaluate correctly on the iPad even when I'm targeting iPhone?

推荐答案

UI_USER_INTERFACE_IDIOM 检查设备是iPhone还是iPad.它检查的是用户界面是处于iPhone模式(1x/2x模式)还是iPad模式.

UI_USER_INTERFACE_IDIOM does not check if the device is an iPhone or iPad. What it checks is whether the user interface is in iPhone mode (the 1x/2x thing) or iPad mode.

如果未将应用配置为以iPad为目标,则由于UI 是iPhone应用,因此它将始终返回UIUserInterfaceIdiomPhone.这是设计使然.

If an app isn't configured to target iPad, it will always return UIUserInterfaceIdiomPhone because the UI is an iPhone app. It is a feature by design.

即使将应用程序配置为仅针对iPhone,只要您使用记录的方法,iPad都应该能够运行它而不会出现任何问题.

And even if the app is configured to target iPhone only, the iPad should be able to run it without any problems as long as you use the methods as documented.

(如果您需要iPad特定的功能,请不要检查设备是否真的是iPad.而是检查单个功能.)

(If you need iPad-specific capabilities, do not check whether the device really is an iPad. Instead, check for individual capability.)

这篇关于UI_USER_INTERFACE_IDIOM是否可与目标设备系列一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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