Zelda 是一个支持链式语法的 FlexBox 布局库,是针对 YogaKit 的二次封装

Related tags

Layout Zelda
Overview

Zelda

CI Status Version License Platform

Zelda 是一个支持链式语法的 FlexBox 布局库,是针对 YogaKit 的二次封装,可以快速的让 iOS 原生开发人员使用 FlexBox 技术进行 UI 布局。

安装

pod 'Zelda'

简单使用

#import <Zelda/UIView+Zelda.h>

UIView *container = [UIView new];
container.backgroundColor = UIColor.redColor;
[self.view addSubview:container];
container
    .zelda
    .flexDirection(ZDFlexDirectionRow)
    .alignItems(ZDAlignCenter)
    .margin(100)
    .height(100)
    .width(100);

UIView *view1 = [UIView new];
view1.backgroundColor = UIColor.grayColor;
[container addSubview:view1];
view1.zelda.height(30).width(30);

UIView *view2 = [UIView new];
view2.backgroundColor = UIColor.blueColor;
[container addSubview:view2];
view2.zelda.height(30).width(30).marginHorizontal(10);

[container.zelda applyLayout];

per_ 开头使用百分比数值:

UIView *view = [UIView new];
// 代表宽高分别占据父组件的30%、10%
view.zelda.per_width(30).per_height(10);

zd_ 开头获取当前组件的布局数值:

UIView *view = [UIView new];
view.zelda.width(30).height(30);
CGFloat height = view.zelda.zd_height;
// todo something...

运行示例

git clone [email protected]:ljunb/Zelda.git
cd Zelda/Example && pod install
You might also like...
Owner
破而后立
饼
An flexbox layout aimed at easy to use, which depend on Yoga.

DDFlexbox A flexbox framework for easy using. Install pod 'DDFlexbox' Template install Recommend using templates to create flexbox views. cd Script/

Daniel 12 Mar 23, 2022
Flexbox in Swift, using Facebook's css-layout.

SwiftBox A Swift wrapper around Facebook's implementation of CSS's flexbox. Example let parent = Node(size: CGSize(width: 300, height: 300),

Josh Abernathy 811 Jun 23, 2022
Yoga is a cross-platform layout engine which implements Flexbox.

Yoga Building Yoga builds with buck. Make sure you install buck before contributing to Yoga. Yoga's main implementation is in C++, with bindings to su

Meta 15.8k Jan 9, 2023
FlexLayout adds a nice Swift interface to the highly optimized facebook/yoga flexbox implementation. Concise, intuitive & chainable syntax.

FlexLayout adds a nice Swift interface to the highly optimized Yoga flexbox implementation. Concise, intuitive & chainable syntax. Flexbox is an incre

layoutBox 1.7k Dec 30, 2022
An flexbox layout aimed at easy to use, which depend on Yoga.

DDFlexbox A flexbox framework for easy using. Install pod 'DDFlexbox' Template install Recommend using templates to create flexbox views. cd Script/

Daniel 12 Mar 23, 2022
Flexbox in Swift, using Facebook's css-layout.

SwiftBox A Swift wrapper around Facebook's implementation of CSS's flexbox. Example let parent = Node(size: CGSize(width: 300, height: 300),

Josh Abernathy 811 Jun 23, 2022
Yoga is a cross-platform layout engine which implements Flexbox.

Yoga Building Yoga builds with buck. Make sure you install buck before contributing to Yoga. Yoga's main implementation is in C++, with bindings to su

Meta 15.8k Jan 9, 2023