iOS 屏幕适配
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iOS 屏幕适配相关的知识,希望对你有一定的参考价值。
#define WIDTH CGRectGetWidth([UIScreen mainScreen].bounds) #define HEIGHT CGRectGetHeight([UIScreen mainScreen].bounds) #define Screen [UIScreen mainScreen].bounds #define autoSizeScaleX (WIDTH>480?WIDTH/320.0:1.0) #define autoSizeScaleY (WIDTH>480?HEIGHT/568.0:1.0) #define WidthScale (autoSizeScaleX*WIDTH/750.0) #define HeightScale (autoSizeScaleY*HEIGHT/1334.0) CG_INLINE CGRect CGLFLMake(CGFloat x, CGFloat y, CGFloat width, CGFloat height) { CGRect rect; rect.origin.x = x *autoSizeScaleX; rect.origin.y = y *autoSizeScaleY; rect.size.width = width *autoSizeScaleX; rect.size.height = height *autoSizeScaleY; return rect; } CG_INLINE CGPoint CGPointLFLMake(CGFloat x, CGFloat y) { CGPoint pointLFL; pointLFL.x = x * autoSizeScaleX; pointLFL.y = y * autoSizeScaleY; return pointLFL; } CG_INLINE CGSize CGSizeLFLMake(CGFloat width, CGFloat height) { CGSize sizeLFL; sizeLFL.width = width* autoSizeScaleX; sizeLFL.height = height* autoSizeScaleY; return sizeLFL; } #define FontScale 72.0/96.0
以上是关于iOS 屏幕适配的主要内容,如果未能解决你的问题,请参考以下文章
Android 屏幕适配屏幕适配基础概念 ① ( Android 与 iOS 屏幕宽高比种类 | 屏幕像素密度 DPI )