zoukankan      html  css  js  c++  java
  • 66.九宫格布局

    //    每个item宽高

        CGFloat W = 90;

        CGFloat H = 110;

    //    每行列数

        NSInteger rank = 4;

    //    每列间距

        CGFloat rankMargin = (self.view.frame.size.width-rank *W)/(rank-1);

    //    每行间距

        CGFloat rowMargin = 30;

    //    item索引-->根据需求改变索引

        NSUInteger index = 9;

        for (int i=0; i<index; i++) {

    //     Item  X轴

            CGFloat X = (i%rank)*(W+rankMargin);

            CGFloat Y = (i/rank)*(H+rowMargin);

    //        Item top

            CGFloat top = 50;

            UIImageView *imageV = [[UIImageView alloc]init];

            imageV.image = [UIImage imageNamed:@"IMG_1170 2"];

            imageV.frame = CGRectMake(X, Y+top, W, H);

            [self.view addSubview:imageV];

        }

        

    }

  • 相关阅读:
    python之enumerate
    PyCharm Debug 调试
    兼容性测试方法
    mongo基本命令
    mongodb启动
    安装STF
    新家
    用数组实现的最大堆(C++)
    VS2013调用GLPK求解线性规划
    转:Java读取txt文件和写入txt文件
  • 原文地址:https://www.cnblogs.com/qiangzheVSruozhe/p/9843317.html
Copyright © 2011-2022 走看看