您的位置:首页 > 其它

94-iPad和iPhone设置判断

2015-03-24 22:33 246 查看
iPad开发中比iPhone上多了两个控制器
1.UISplitViewConroller
2.UIPopoverController
这两个控件只能在iPad上运行

为了开发同时兼容 iPhone 和iPad 的应用,可以通过 iOS 提供的 UIDevice 类,该对象的 userInterfaceIdiom 属性返回一个UIUserInterfaceIdiom 枚举值, 该枚举值包含如下两个值
UIUserInterfaceIdiomPhone : 代表 iPhone 设备
UIUserInterfaceIdiomPad : 代表 iPad 设备

判断当前运行的设置代码如下
// 判断当前是不是运行在iPhone设备上
if ([[UIDevice currentDevice] userInterfaceIdiom]
== UIUserInterfaceIdiomPhone) {
…...
}

// 适配时判断手机的系统版本
#define iOS7 ([UIDevice currentDevice].systemVersion.floatValue >= 7.0)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: