#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, IPhoneType) {
iPhone4Type = 0,
iPhone5Type,
iPhone6Type,
iPhone6PlusType
};
@interface CalculateLayout : NSObject
/**
* 基于UI设计的iPhone6设计图的全机型高度适配
*
* @param height View高度
*
* @return 适配后的高度
*/
+ (CGFloat)neu_layoutForAlliPhoneHeight:(CGFloat)height;
/**
* 基于UI设计的iPhone6设计图的全机型宽度适配
*
* @param width 宽度
*
* @return 适配后的宽度
*/
+ (CGFloat)neu_layoutForAlliPhoneWidth:(CGFloat)width;
#define iPhone4Height (480.f)
#define iPhone4Width (320.f)
#define iPhone5Height (568.f)
#define iPhone5Width (320.f)
#define iPhone6Height (667.f)
#define iPhone6Width (375.f)
#define iPhone6PlusHeight (736.f)
#define iPhone6PlusWidth (414.f)
#pragma mark - 适配所有机型高度
+ (CGFloat)neu_layoutForAlliPhoneHeight:(CGFloat)height {
CGFloat layoutHeight = 0.0f;
if (iPhone4) {
layoutHeight = ( height / iPhone6Height ) * iPhone4Height;
} else if (iPhone5) {
layoutHeight = ( height / iPhone6Height ) * iPhone5Height;
} else if (iPhone6) {
layoutHeight = ( height / iPhone6Height ) * iPhone6Height;
} else if (iPhone6P) {
layoutHeight = ( height / iPhone6Height ) * iPhone6PlusHeight;
} else {
layoutHeight = height;
}
return layoutHeight;
}
+ (CGFloat)neu_layoutForAlliPhoneWidth:(CGFloat)width {
CGFloat layoutWidth = 0.0f;
if (iPhone4) {
layoutWidth = ( width / iPhone6Width ) * iPhone4Width;
} else if (iPhone5) {
layoutWidth = ( width / iPhone6Width ) * iPhone5Width;
} else if (iPhone6) {
layoutWidth = ( width / iPhone6Width ) * iPhone6Width;
} else if (iPhone6P) {
layoutWidth = ( width / iPhone6Width ) * iPhone6PlusWidth;
}
return layoutWidth;
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有