GHLFrameKit
示例
要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install
命令。
要求
源代码简单,所有 getter 都是安全的,但您应注意以下 setter 的顺序: right
,bottom
,centerX
,centerY
,center
。
也许您应该在设置 宽度
之前设置 right
,centerX
或 center
,在设置 高度
之前设置 bottom
,centerY
或 center
。
使用方式
UIView *viewA = [UIView new];
viewA.size = CGSizeMake(100, 100);
viewA.center = self.view.center;
viewA.backgroundColor = [UIColor redColor];
[self.view addSubview:viewA];
UIView *viewB = [UIView new];
viewB.top = viewA.bottom + 50;
viewB.left = viewA.left;
viewB.width = 200;
viewB.height = 200;
viewB.backgroundColor = [UIColor purpleColor];
[self.view addSubview:viewB];
CALayer *layer = [CALayer new];
layer.size = CGSizeMake(100, 100);
layer.right = viewA.centerX;
layer.bottom = viewA.top - 50;
layer.backgroundColor = [UIColor blueColor].CGColor;
[self.view.layer addSublayer:layer];
安装
GHLFrameKit 通过 CocoaPods 提供。要安装它,只需简单地将以下行添加到您的 Podfile 中:
pod 'GHLFrameKit'
作者
公红楼, [email protected]
许可
GHLFrameKit 在MIT许可下可用。请参阅LICENSE文件以获取更多信息。