如果我们没有考虑到5的尺寸,我们把应用在5上跑一下会发现,上下多出来一道黑条。

这就需要我们有一定的针对性。

我们可以这样:

#define isIPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ?

CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define ScreenHeight [[UIScreen mainScreen] bounds].size.height
#define ScreenWidth [[UIScreen mainScreen] bounds].size.width
#define StateBarHeight 20
#define MainHeight (ScreenHeight - StateBarHeight)
#define MainWidth ScreenWidth

UILabel *lab=[[UILabel alloc]init];

--------------第一种----------
// if (isIPhone5)
// {
// [lab setFrame:CGRectMake(0, 528, 320, 20)];
// }
// else
// {
// [lab setFrame:CGRectMake(0, 440, 320, 20)];
// }

--------------第二种----------
[lab setFrame:CGRectMake(0, MainHeight-20, 320, 20)];

lab.backgroundColor=[UIColor redColor];
[self.view addSubview:lab];

iphone4s和iphone5屏幕尺寸的兼容相关推荐

  1. 0119吧 iPhone 屏幕尺寸

    1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角线 Diagonal 逻辑分辨率(point) Scale Factor 设备分辨率(pixel) PPI 3GS ...

  2. html5开发之ios屏幕适配,iOS开发屏幕尺寸以及屏幕适配等问题(转载内容)

    原帖地址:http://blog.csdn.net/phunxm/article/details/42174937/ 仅供我个人收藏学习,原博主如不同意请联系qq651263878进行删除,在此表示感 ...

  3. iphone屏幕尺寸总结

    http://blog.csdn.net/phunxm/article/details/42174937#t24 1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角线 ...

  4. iOS 屏幕尺寸、分辨率、适配

    1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角线 Diagonal 逻辑分辨率(point) Scale Factor 设备分辨率(pixel) PPI 3GS ...

  5. IOS 开发 iPhone屏幕尺寸、分辨率及适配

    版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[+] 1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角线 Diagonal 逻辑分辨率(point ...

  6. ios学习7_iPhone屏幕尺寸、分辨率及适配

    1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角线 Diagonal 逻辑分辨率(point) Scale Factor 设备分辨率(pixel) PPI 3GS ...

  7. 关于iPhone屏幕尺寸、分辨率及适配

    1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角线 Diagonal 逻辑分辨率(point) Scale Factor 设备分辨率(pixel) PPI 3GS ...

  8. iPhone屏幕尺寸、分辨率及适

    原作者传送http://blog.csdn.net/phunxm/article/details/42174937 1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角 ...

  9. iOS 【iOS iPhone屏幕尺寸、分辨率及屏幕适配】

    1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角线 Diagonal 逻辑分辨率(point) Scale Factor 设备分辨率(pixel) PPI 3GS ...

最新文章

  1. 数据分析从零开始实战,Pandas读写Excel/XML数据
  2. actor multithreading concurrency
  3. jBPM4.4 no jBPM DB schema:
  4. complex--创建复数
  5. 计算机网络:网络设备知识笔记
  6. css sprite原理优缺点及使用
  7. 一篇文章搞懂filebeat(ELK)
  8. 查看目录下所有文件 dir 。
  9. c# opencv车牌识别_牛逼plus的springboot+maven车牌识别开源系统
  10. C#联合halcon应用——大华相机采集类
  11. 核方法概述----正定核以及核技巧(Gram矩阵推导正定核)
  12. 自己动手做个智能小车(2)
  13. 硬件设计3---什么是电容?
  14. 点云粗配准之采样一致性
  15. java视频转换flv_java使用ffmpeg转换视频为flv文件
  16. 用robot framework + python实现http接口自动化测试框架
  17. DMZ主机的使用设置
  18. 《3D数学基础:图形与游戏开发》 学习笔记(一)
  19. minio下载安装与API操作
  20. 没有权限打开服务器共享文件夹权限,Win 7无法访问共享文件夹,提示您可能没有权限使用网络资源。...

热门文章

  1. 七、ref引用与数组的常用方法
  2. 微信公众号批量打标签的自动化实现方法
  3. 强大的实用的mac软件卸载应用软件,彻底清除App残留
  4. 发一个笔筒式的摄像头驱动(台湾原相科技)
  5. 在线考试答题刷题小程序
  6. android 工具栏透明,Android 系统状态栏沉浸式/透明化完整解决方案
  7. Oracle中按天、自然周、月、季、年周期统计
  8. 屏幕撕裂及掉帧原因与解决方案
  9. 使用moment.js获取一个自然周开始日期和结束日期
  10. 古人的智慧之回文诗——《两相思》