首页 > 代码库 > iOS 屏幕适配

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 CGRectCGLFLMake(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 CGPointCGPointLFLMake(CGFloat x, CGFloat y){    CGPoint pointLFL;    pointLFL.x = x * autoSizeScaleX;    pointLFL.y = y * autoSizeScaleY;    return pointLFL;}CG_INLINE CGSizeCGSizeLFLMake(CGFloat width, CGFloat height){    CGSize sizeLFL;    sizeLFL.width = width* autoSizeScaleX;    sizeLFL.height = height* autoSizeScaleY;    return sizeLFL;}#define FontScale 72.0/96.0

 

iOS 屏幕适配