https://github.com/onecatyu/flexkit
FlexBox Layout, 支持链式调用,虚拟view.
https://github.com/onecatyu/flexkit
div flex yoga
Last synced: 8 months ago
JSON representation
FlexBox Layout, 支持链式调用,虚拟view.
- Host: GitHub
- URL: https://github.com/onecatyu/flexkit
- Owner: ONECATYU
- License: mit
- Created: 2018-06-05T08:24:44.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-06-03T07:36:20.000Z (about 7 years ago)
- Last Synced: 2025-10-23T09:55:04.173Z (8 months ago)
- Topics: div, flex, yoga
- Language: Objective-C
- Size: 4.25 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FlexKit
* 支持虚拟div,避免导致视图增多问题。
* 支持scrollView contentSize。设置scrollView.applyFlexFrameToContentSize = true
* 支持CALayer布局,UIView和CALayer混合布局。
* 根据node树,UIView/CALayer自动添加到父视图。在布局结束后,调用view.yoga.adjustsViewHierarchy()
# 使用
* 可配合UITableView+FDTemplateLayoutCell使用,避免手动计算高度
```swift
contentView.makeFlexLayout { (make) in
make.padding(12)
make.addChild(self.titleLabel)
make.addChild(self.contentLabel).marginTop(10)
make.addChild(self.contentImgView).marginTop(10)
make.addChild(nil, withMakeLayout: { (make) in
make.flexDirection(.row).justifyContent(.spaceBetween).marginTop(10)
make.addChild(self.userNameLabel)
make.addChild(self.timeLabel)
})
}
contentView.yoga.applyLayout(preservingOrigin: false)
//OC中通过@100/@"50%",分别设置数值或者百分比
make.width(@100).height(@"50%");
```