代码库> 其他> iOS 流式自动布局 适配All Screen
iOS 流式自动布局 适配All Screen
关注
上传者:xincc 分类:其他(Others)
查看次数:2785 下载次数:233
上传时间:2015-09-08 大小:41 B
 //bg view
    UIView * viewBackGround = [[UIView alloc] initWithFrame:CGRectZero];


    viewBackGround.backgroundColor = UIColor.redColor;
    [self.view addSubview:viewBackGround fillByMargin:ALMarginZero()];




//clip to two part

    UIView * topPart = [[UIView alloc] initWithFrame:CGRectZero];
    UIView * bottomPart = [[UIView alloc] initWithFrame:CGRectZero];
    topPart.backgroundColor = UIColor.blackColor;
    bottomPart.backgroundColor = UIColor.darkGrayColor;

    [viewBackGround addSubviews:@[topPart, bottomPart] flowLayoutDirection:ALLayoutDirectionVertical fillByMargin:ALMarginMakeLeft(50)];

//set top part
    UIView * topPart1 = [[UIView alloc] initWithFrame:CGRectZero];
    UIView * topPart2 = [[UIView alloc] initWithFrame:CGRectZero];
    UIView * topPart3 = [[UIView alloc] initWithFrame:CGRectZero];
    topPart1.backgroundColor = UIColor.brownColor;
    topPart2.backgroundColor = UIColor.greenColor;
    topPart3.backgroundColor = UIColor.blueColor;


    [topPart addSubviews:@[topPart1,topPart2,topPart3] flowLayoutDirection:ALLayoutDirectionHorizontal fillByMargin:ALMarginMakeTop(100) interval:20.f];

//set bottom part
    UIView * bottomPart1 = [[UIView alloc] initWithFrame:CGRectZero];
    UIView * bottomPart2 = [[UIView alloc] initWithFrame:CGRectZero];
    UIView * bottomPart3 = [[UIView alloc] initWithFrame:CGRectZero];
    bottomPart1.backgroundColor = UIColor.cyanColor;
    bottomPart2.backgroundColor = UIColor.yellowColor;
    bottomPart3.backgroundColor = UIColor.purpleColor;


    [bottomPart addSubviews:@[bottomPart1,bottomPart2,bottomPart3] flowLayoutDirection:ALLayoutDirectionVertical fillByMargin:ALMarginMakeRight(50) interval:10.f];


测试环境:Xcode 6.2,iOS 6.0 以上
收藏
我来说两句
发表评论
您还没有登录!请登录注册
所有评论(0
提示
sina weixin mail 回到顶部