码迷,mamicode.com
首页 > 移动开发 > 详细

iOS 屏幕适配

时间:2016-09-18 22:12:50      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:

#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 屏幕适配

标签:

原文地址:http://www.cnblogs.com/levy/p/5883020.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!