?iOS rapidScreen Compatible AdapterKit(Deprecate)
中国文化与艺术
Aparty
...
With CocoaPods, add this line to your Podfile.
od 'ScreenCompatible_LFL', '~> 1.0.0'
od install
下载源码后把FrameAutoScaleLFL
文件夹直接拖入工程即可
如果发现使用后代码适配依旧有问题,请检查你的工程中,启动图片是否完整,如果启动图片不完整,默认最大图片尺寸为屏幕尺寸.
使用宏布局,框架定义了一系列宏,更方便设置,详见demo
// 2016年3.20号更新
// 1.frame
// RectMake_LFL(<#X_LFL#>, <#Y_LFL#>, <#WIDTH_LFL#>, <#HEIGHT_LFL#>)
RectMake_LFL(20, 20, 100, 100);
// 2. point
// PointMake_LFL(<#X_LFL#>, <#Y_LFL#>)
PointMake_LFL(30, 30);
// 3. Size
// SizeMake_LFL(<#WIDTH_LFL#>, <#HEIGHT_LFL#>)
SizeMake_LFL(60, 60);
// 4. edgeInsets
// EdgeInsets_LFL(<#X_LFL#>, <#Y_LFL#>, <#WIDTH_LFL#>, <#HEIGHT_LFL#>)
EdgeInsets_LFL(10, 0, 10, 0);
使用frame
布局
**
pragma mark
.1普通使用 以下测试。请切换模拟器查看打印数据对比 是否等比例缩放 iPhone4s -6sPlus 如果公司UI图是以iphone6为基准, 直接写UI图上的坐标即可,如果其他尺寸,进入FrameAutoScaleLFL.h文件头文件修改RealUISrceenHight 和RealUISrceenWidth 为其他尺寸即可.
**
.1 Eg: [FrameAutoScaleLFL CGLFLMakeX:30 Y:300 width:200 height:40]
etting a view Frame With the UIfigure number all value will be size to fit UIScreen
部对应数值都将按照比例缩放返回一个进过处理缩放比例的frame.
/
(CGRect)CGLFLMakeX:(CGFloat) x Y:(CGFloat) y width:(CGFloat) width height:(CGFloat) height;
**
etting a view Frame With the UIfigure number special CGRectGetY
部对应数值都将按照比例缩放而Y参数除外的frame.eg: 获取上个控件的Y,不可以再次缩放.
/
(CGRect)CGLFLMakeX:(CGFloat) x CGRectGetY:(CGFloat) GetY width:(CGFloat) width height:(CGFloat) height;
**
etting a view Frame With the UIfigure number special CGRectGetX
回正常处理通过CGRectGetX方式的frame(其他均正常) special X eg: 20 always 20 Value
如控件,左边距离 屏幕20 就可以使用这个设置
/
(CGRect)CGLFLMakeGetX:(CGFloat)GetX Y:(CGFloat) Y width:(CGFloat) width height:(CGFloat) height;
**
etting a view Frame With the UIfigure number special height eg: 64 always 64 Value
如导航栏的高度,一直不变,或者设置固定的高度,可以使用
/
(CGRect)CGLFLMakeX:(CGFloat) x Y:(CGFloat) y width:(CGFloat) width heightAllSame:(CGFloat) heightAllSame;
**
eturn a fullSrceen frame
/
(CGRect)CGLFLfullScreen;
abel_LFL.frame =[FrameAutoScaleLFL CGLFLMakeX:100 Y:0 width:100 height:100];
abel_LFL.frame.size = [FrameAutoScaleLFL CGSizeLFLMakeMainScreenSize];
abel_LFL.frame.origin= [FrameAutoScaleLFL CGLFLPointMakeX:200 Y:200];
masonry
测试耗时,创建view控件100个,同样位置大小,测试次数三次,相比较而言,对于简单布局,采取frame效率更佳.(不同项目要求不同,可以搭配使用).```objc
- (void)viewDidLoad {
[super viewDidLoad];
// 测试:创建100个view 颜色均为红色
#define TICK NSDate *startTime = [NSDate date];
#define TOCK NSLog(@"耗时统计:%f", -[startTime timeIntervalSinceNow]);
//[self Masonry]; // 0.017872 0.016632 0.020712
[self ScreenCompatible]; // 0.001341 0.000702 0.000923
}
- (void)Masonry{
for (int i = 0; i < 100; i++) {
UIView *view = [[UIView alloc]init];
view.backgroundColor = [UIColor redColor];
[self.view addSubview:view];
__weak typeof(self) weakSelf=self;
[view mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(100);
make.top.equalTo(weakSelf.view.mas_top);
make.left.equalTo(weakSelf.view.mas_left);
}];
}
}
- (void)ScreenCompatible{
for (int i = 0; i < 100; i++) {
UIView *view = [[UIView alloc]init];
view.backgroundColor = [UIColor redColor];
[self.view addSubview:view];
view.frame = RectMake_LFL(0,0, 100, 100);
}
}
```
2018 - 05 - 18
Stargazers over time
,star
,fork
Xcode warning
,更新日志 .2017 - 03 - 16
2016 - 03 - 05
API
2016 - 02 - 19
2016 - 01 - 23
2016 - 01 - 22
2015 - 11 - 14
Email:
[email protected]