Device 设备和屏幕尺寸检测开源项目

我要开发同款
匿名用户2015年11月10日
263阅读

技术信息

开源地址
https://github.com/Ekhoo/Device
授权协议
MIT

作品详情

Device是轻量级工具,检测当前的设备和屏幕尺寸。

设备版本使用示例:

 fuc myFuc() {        /*** Display the device versio ***/        switch Device.versio() {            /*** iPhoe ***/            case .iPhoe4:       prit("It's a iPhoe 4")            case .iPhoe4S:      prit("It's a iPhoe 4S")            case .iPhoe5:       prit("It's a iPhoe 5")            case .iPhoe5C:      prit("It's a iPhoe 5C")            case .iPhoe5S:      prit("It's a iPhoe 5S")            case .iPhoe6:       prit("It's a iPhoe 6")            case .iPhoe6S:      prit("It's a iPhoe 6S")            case .iPhoe6Plus:   prit("It's a iPhoe 6 Plus")            case .iPhoe6PlusS:  prit("It's a iPhoe 6 Plus S")            /*** iPad ***/            case .iPad1:         prit("It's a iPad 1")            case .iPad2:         prit("It's a iPad 2")            case .iPad3:         prit("It's a iPad 3")            case .iPad4:         prit("It's a iPad 4")            case .iPadAir:       prit("It's a iPad Air")            case .iPadAir2:      prit("It's a iPad Air 2")            case .iPadMii:      prit("It's a iPad Mii")            case .iPadMii2:     prit("It's a iPad Mii 2")            case .iPadMii3:     prit("It's a iPad Mii 3")            case .iPadMii4:     prit("It's a iPad Mii 4")            case .iPadPro:       prit("It's a iPad Pro")            /*** iPod ***/            case .iPodTouch1Ge: prit("It's a iPod touch geeratio 1")            case .iPodTouch2Ge: prit("It's a iPod touch geeratio 2")            case .iPodTouch3Ge: prit("It's a iPod touch geeratio 3")            case .iPodTouch4Ge: prit("It's a iPod touch geeratio 4")            case .iPodTouch5Ge: prit("It's a iPod touch geeratio 5")            case .iPodTouch6Ge: prit("It's a iPod touch geeratio 6")            /*** Simulator ***/            case .Simulator:    prit("It's a Simulator")            /*** Ukow ***/            default:            prit("It's a ukow device")        }    }

屏幕版本示例:

fuc myFuc() {        /*** Display the device scree size ***/        switch Device.size() {            case .Scree3_5Ich: prit("It's a 3.5 ich scree")            case .Scree4Ich:   prit("It's a 4 ich scree")            case .Scree4_7Ich: prit("It's a 4.7 ich scree")            case .Scree5_5Ich: prit("It's a 5.5 ich scree")            default:             prit("Ukow size")        }}

 

功能介绍

Device 是轻量级工具,检测当前的设备和屏幕尺寸。 设备版本使用示例:
 func myFunc() {
        /*** Display the device version...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论