博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
The properties for UIDevice
阅读量:7210 次
发布时间:2019-06-29

本文共 852 字,大约阅读时间需要 2 分钟。

hot3.png

For the UIDevice.h in the iOS SDK, could to fetch more information about the current device.
common methods have as follow:
1. Judge the screen is Retina or not.
   #define isRetina ([UIScreen instancesRespondToSelector:@selector(currentMode)] ?   CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
2. Judge run on the simulator or not
   #define isSimulator ([[[UIDevice currentDevice] model] rangeOfString:@”Simulator”].location != NSNotFound)
3. Judge the device is iPad or not
   (1) if the device version is more than 3.2, so use it:
      #define isPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
   (2) if want to judge at all device version(contain 3.0), should be as this:
     #define isPad ([[[UIDevice currentDevice] model] rangeOfString:@"iPad"].location != NSNotFound)

转载于:https://my.oschina.net/ahuaahua/blog/41922

你可能感兴趣的文章
搜索框中“请输入搜索keyword”
查看>>
CentOS6.5与XP双系统安装
查看>>
Python 更新set
查看>>
shell语法简单介绍
查看>>
Web服务器的工作原理
查看>>
使用WinSetupFromUSB来U盘安装windowsXP(不使用win PE系统)
查看>>
JAVA Calendar具体解释
查看>>
MongoDB入门简单介绍
查看>>
Git show-branch显示提交信息
查看>>
秒杀 ILSpy 等反编译利器 DotNet Resolver
查看>>
SharePoint 2013 中代码创建列表查阅项字段
查看>>
2014仲秋校招之面试篇
查看>>
负载均衡研究 基础
查看>>
10.cadence.自定义焊盘的创建[原创]
查看>>
shell编程总结
查看>>
Docker源码分析(七):Docker Container网络 (上)
查看>>
一些旁门左道
查看>>
Common Pitfalls In Machine Learning Projects
查看>>
Android内存泄漏分析及调试
查看>>
todoing
查看>>