Possible Duplicate:
Best way to programmatically detect iPad/iPhone hardware
我正在准备一个应用程序,我想在 iPhone 和 iPad 上使用它。
如何检测当前主机设备是iPhone还是iPad?
基于此我想对用户界面进行更改
最佳答案
有很多方法可以找到应用程序正在哪个设备上运行。
[[[UIDevice currentDevice] systemVersion] floatValue];
通过此代码我们可以获取当前设备的版本,以便我们可以检查该设备是否是iPhone或iPad。
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
// iPad-specific interface here
}
else
{
// iPhone and iPod touch interface here
}
关于iphone - 如何检测主机设备是iPhone还是iPad?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4343088/