获取安装游戏应用设备信息(swift)
来源:互联网 发布:中科大软件学院排名 编辑:程序博客网 时间:2024/06/05 10:21
有时候我们做游戏,会针对ipad或者iphone做一些特殊的设置,让其游戏更好的适应不同的设备,这样,我们就需要在代码里分辨和判断打开游戏的是什么设备,好调用相应的逻辑处理。好吧,这个没什么大问题,直接贴代码吧
//分辨不同设备
if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Phone{
print("iphone")
}
if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad{
print("ipad")
}
如果你想要获得当前设备更多的信息,主要是通过返回的UIDevice实例,用他的属性获得更多设备信息
UIDevice类的部分属性
public var name: String { get } // e.g. "My iPhone"
public var model: String { get } // e.g. @"iPhone", @"iPod touch"
public var localizedModel: String { get } // localized version of model
public var systemName: String { get } // e.g. @"iOS"
public var systemVersion: String { get } // e.g. @"4.0"
public var orientation: UIDeviceOrientation { get } // return current device orientation. this will return UIDeviceOrientationUnknown unless device orientation notifications are being generated.
@available(iOS 6.0, *)
public var identifierForVendor: NSUUID? { get } // a UUID that may be used to uniquely identify the device, same across apps from a single vendor.
具体使用方法:
//获取当前设备
let device = UIDevice.currentDevice()
print(device.name)
print(device.model)
print(device.systemName)
print(device.systemVersion)
- 获取安装游戏应用设备信息(swift)
- 【Swift】获取设备信息
- 获取android设备已安装应用信息
- 获取android设备已安装应用信息
- Swift获取手机设备信息
- Swift获取手机设备信息
- iOS开发-Swift获取手机设备信息(UIDevice)
- android 获取设备上安装的非系统应用信息
- swift常用宏/获取设备信息
- iOS获取设备信息与应用信息
- android获取设备和应用信息
- Android 获取设备所有应用信息
- iOS获取应用和设备信息
- 获取当前设备所有应用基础信息
- swift 获取app、ios 版本号及设备信息
- 获取已安装应用信息
- 获取已安装设备的高级信息
- 获取已安装设备的高级信息
- Jfire-Orm迎来第一个功能更新
- 病毒侵袭(ac自动机模板)
- IOS 纯代码实现视图控制器的封装
- android json解析(fastjson,Gson等)
- atom
- 获取安装游戏应用设备信息(swift)
- 控制文本框只输入正负浮点数
- Android使用Bmob移动后端云Restful API需要注意的问题
- 来Godeye分享你的代码,你的经验,你的生活
- POJ-3617 Best Cow Line
- 老&新码农的技术理想
- 用链表实现的栈(单向链表,表头插入和删除)
- 干货!原来实现一个SSO认证服务器是这样的
- oracle11g各版本下载地址11.2.0.3 patch