码迷,mamicode.com
首页 > 移动开发 > 详细

判断不同IOS设备

时间:2014-07-12 08:35:45      阅读:277      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   os   io   line   

var iOSGen = iPhone.generation;
  
   
  
    if (Debug.isDebugBuild) {
  
        Debug.Log("iPhone.generation     : " + iPhone.generation);
  
        Debug.Log("SystemInfo.deviceType : " + SystemInfo.deviceType);
  
        Debug.Log("SystemInfo.deviceModel: " + SystemInfo.deviceModel);
  
    }
  
      
  
    if (iOSGen == iPhoneGeneration.iPhone3GS) {
  
        SetQualityLevel(2);
  
    } else if (iOSGen == iPhoneGeneration.iPhone4) {
  
        SetQualityLevel(3);
  
    } else if (iOSGen == iPhoneGeneration.iPhone4S) {
  
        SetQualityLevel(3);
  
    } else if (iOSGen == iPhoneGeneration.iPad1Gen) {
  
        SetQualityLevel(2);
  
    } else if (iOSGen == iPhoneGeneration.iPad2Gen) {
  
        SetQualityLevel(4);
  
    } else if (iOSGen == iPhoneGeneration.iPad3Gen) {
  
        SetQualityLevel(4);
  
    } else if (iOSGen == iPhoneGeneration.iPodTouch3Gen) {
  
        SetQualityLevel(3);    
  
    } else if (iOSGen == iPhoneGeneration.iPodTouch4Gen) {
  
        SetQualityLevel(3);    
  
    } else {
  
      
  
        if (Debug.isDebugBuild) { Debug.LogWarning("Can‘t detect iOS device type."); }
  
          
  
        var device : String = SystemInfo.deviceModel;
      // 调试device :ipad air =iPad4,1iphone 5 =iPhone5,2  所以 下面的判断是错误的  需要做字符串处理  
if (device == "iPhone") { if (Debug.isDebugBuild) { Debug.Log("Device type iPhone"); } SetQualityLevel(4); } else if (device == "iPad") { if (Debug.isDebugBuild) { Debug.Log("Device type iPad"); } SetQualityLevel(4); } else if (device == "iPod") { if (Debug.isDebugBuild) { Debug.Log("Device type iPod"); } SetQualityLevel(3); } }

或者:

string id = "";
if (deviceFlag == iPhoneGeneration.iPhone || deviceFlag == iPhoneGeneration.iPhone3G || deviceFlag == iPhoneGeneration.iPhone3GS|| deviceFlag == iPhoneGeneration.iPhone4
|| deviceFlag == iPhoneGeneration.iPhone4S || deviceFlag == iPhoneGeneration.iPhone5 || deviceFlag == iPhoneGeneration.iPhone5C || deviceFlag == iPhoneGeneration.iPhone5S
|| deviceFlag == iPhoneGeneration.iPhoneUnknown || deviceFlag == iPhoneGeneration.Unknown || deviceFlag == iPhoneGeneration.iPodTouch1Gen || deviceFlag ==iPhoneGeneration.iPodTouch2Gen
|| deviceFlag == iPhoneGeneration.iPodTouch3Gen || deviceFlag == iPhoneGeneration.iPodTouch4Gen || deviceFlag == iPhoneGeneration.iPodTouch5Gen || deviceFlag == iPhoneGeneration.iPodTouchUnknown
)
{
id = "0";
}
if (deviceFlag == iPhoneGeneration.iPad1Gen || deviceFlag == iPhoneGeneration.iPad2Gen || deviceFlag == iPhoneGeneration.iPad3Gen || deviceFlag == iPhoneGeneration.iPad4Gen || deviceFlag == iPhoneGeneration.iPadMini1Gen || deviceFlag == iPhoneGeneration.iPadUnknown)
{
id = "1";
}

 

 

判断不同IOS设备,布布扣,bubuko.com

判断不同IOS设备

标签:style   blog   color   os   io   line   

原文地址:http://www.cnblogs.com/123ing/p/3835196.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!