Latest 0.0.1
Homepage https://github.com/ONECATYU/WSFlexLayout
License MIT
Platforms ios 8.0, requires ARC
Dependencies Yoga
Frameworks UIKit, Foundation
Authors

在YogaKit基础上,增加了链式调用,虚拟div

使用

WSFlexLayout

视图层级:

WSFlexLayout

    UIView *container = ...
    UIView *leftView = ...
    UILabel *titleLabel = ...
    UILabel *descLabel = ...

    [self.view yg_makeLayout:^(YGLayoutMaker *make) {
        make.justifyContent(YGJustifyCenter);

        ///如果 addChild = nil,方法里会自己创建一个虚拟view
        ///也可以使用addVirtualChildWithMakeLayout:方法
        [make addChild:container yg_makeLayout:^(YGLayoutMaker *make) {
            make
            .flexDirection(YGFlexDirectionRow)
            .width(YGPercentValue(100))
            .padding(YGPointValue(12))
            .height(YGPointValue(150));

            make.addChild(leftView)
            .aspectRatio(1);

            [make addChild:nil yg_makeLayout:^(YGLayoutMaker *make) {
                make
                .flexGrow(1)
                .flexShrink(1)
                .justifyContent(YGJustifySpaceBetween)
                .paddingLeft(YGPointValue(12));

                [make addChild:nil yg_makeLayout:^(YGLayoutMaker *make) {
                    make.addChild(titleLabel);
                    make.addChild(descLabel).top(YGPointValue(6));
                }];

                [make addChild:nil yg_makeLayout:^(YGLayoutMaker *make) {
                    make
                    .flexDirection(YGFlexDirectionRow)
                    .justifyContent(YGJustifySpaceBetween);

                    make.addChild(bottomLeftView)
                    .width(YGPointValue(80))
                    .height(YGPointValue(20))
                    .alignSelf(YGAlignFlexEnd);

                    make.addChild(bottomRightView)
                    .height(YGPointValue(30))
                    .aspectRatio(1);
                }];
            }];

        }];
    }];

Latest podspec

{
    "name": "WSFlexLayout",
    "version": "0.0.1",
    "summary": "FlexLayout,u652fu6301u94feu5f0fu8c03u7528,u865au62dfdiv",
    "description": "*u94feu5f0fu8c03u7528n*u865au62dfdivn*u57fau4e8eYogaKit",
    "homepage": "https://github.com/ONECATYU/WSFlexLayout",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "ONECATYU": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/ONECATYU/WSFlexLayout.git",
        "tag": "0.0.1"
    },
    "source_files": [
        "WSFlexLayout",
        "WSFlexLayout/**/*.{h,m}"
    ],
    "frameworks": [
        "UIKit",
        "Foundation"
    ],
    "requires_arc": true,
    "dependencies": {
        "Yoga": [
            "~> 1.6.0"
        ]
    }
}

Pin It on Pinterest

Share This