zoukankan      html  css  js  c++  java
  • 九宫格代码

          CGFloat margin = 10.0f;
       
        CGFloat appViewWidth = (375 - 4 * margin)/3;
        CGFloat appViewHeight = (375 - 4 * margin)/3;
       
        //2. 完成布局设计
        //三列
        int totalloc = 3;
       
       
        for (int i = 0; i < 9; i++) {
             int row = i / totalloc;//行号
             int loc = i % totalloc;//列号
             CGFloat appViewX = margin + (margin + appViewWidth) * loc;
             CGFloat appViewY = margin + (margin + appViewHeight) * row;
                  //创建UIView控件
            UIView *appView = [[UIView alloc] initWithFrame:CGRectMake(appViewX, appViewY, appViewWidth, appViewHeight)];
            appView.backgroundColor = [UIColor redColor];
           
             [self.bgView addSubview:appView];
        }
  • 相关阅读:
    Bzoj1597 [Usaco2008 Mar]土地购买
    Bzoj1500 [NOI2005]维修数列
    模拟7 题解
    模拟6 题解
    模拟5 题解
    远古杂题 2
    远古杂题 1
    [NOIP2013]华容道 题解
    奇袭 CodeForces 526F Pudding Monsters 题解
    图论杂题
  • 原文地址:https://www.cnblogs.com/Jackie-subDai/p/9290152.html
Copyright © 2011-2022 走看看