iphone - iOS 6 - 区分 iPhone 5 和其他设备?

标签 iphone objective-c xcode ios6 iphone-5

随着今天 iPhone 5 和新 iPod 的发布,我开始着手优化我的应用程序以利用新的、额外的屏幕空间。我已经到了我的应用程序不再“信箱化”的地步。我知道现在还早,但有谁知道我如何区分新的、更高的设备和旧设备?

理想情况下,它应该是这样的:

if (device is iPhone 5 or taller iPod touch) {
    do stuff that is ideal for the taller screen
} else {
   do what I've been doing before for the smaller screen
}

谢谢!我希望其他人也喜欢 Apple 今天发布的内容!

最佳答案

if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
    CGSize result = [[UIScreen mainScreen] bounds].size;
    if(result.height == 480)
    {
        // iPhone Classic
    }
    if(result.height == 568)
    {
        // iPhone 5
    }
}

see this link for different type of checking

关于iphone - iOS 6 - 区分 iPhone 5 和其他设备?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12398798/

相关文章:

ios - 应用未运行时如何处理远程通知

ios - xcode 在 ios 中显示 3.5 英寸和 4 英寸屏幕的高度相同

macos - Mac QuickTime 组件调试

ios - 单击按钮时将数据写入特征 - Swift

ios - 当目标为 7.0 时,Xcode 引发 "EXC_BAD_ACCESS code=1"

ios - `SCNetworkReachabilityScheduleWithRunLoop` 还是 `SCNetworkReachabilitySetDispatchQueue`?和比赛条件

objective-c - iphone - NSTimers 在后台

swift - 如何处理 podfile 库的 "header file not found"? ('XYZ.h' 文件未找到)- 在 Xcode 中

在 iOS 自定义键盘中使用时不支持 iOS CoreBluetooth 状态

iphone - 如何通过 HTTP POST 发送充满对象的 NSArray?