Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2619996
  • 博文数量: 877
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 5921
  • 用 户 组: 普通用户
  • 注册时间: 2013-12-05 12:25
个人简介

技术的乐趣在于分享,欢迎多多交流,多多沟通。

文章分类

全部博文(877)

文章存档

2021年(2)

2016年(20)

2015年(471)

2014年(358)

2013年(26)

分类: iOS平台

2015-10-10 11:04:22

iOS判断设备-userInterfaceIdiom
http://blog.csdn.net/zhangmiaoping23/article/details/48035027

在编程时可以通过下面语句判断设备,常量UIUserInterfaceIdiomPhone 用于判断是否为iPhone设备,UIUserInterfaceIdiomPad用于判断是否为iPad设备。


if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)

{

// iPhone设备

} else 

{

// iPad 设备

}



 typedef NS_ENUM(NSInteger, UIUserInterfaceIdiom) {
    UIUserInterfaceIdiomUnspecified = -1,
#if __IPHONE_3_2 <= __IPHONE_OS_VERSION_MAX_ALLOWED
    UIUserInterfaceIdiomPhone,           // iPhone and iPod touch style UI
    UIUserInterfaceIdiomPad,             // iPad style UI
#endif
};
阅读(607) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~