九宫格代码

news/2024/7/5 4:27:21

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];
}

转载于:https://www.cnblogs.com/Jackie-subDai/p/9290152.html


http://lihuaxi.xjx100.cn/news/237666.html

相关文章

区块链未来的发展前景是什么?

链客&#xff0c;专为开发者而生&#xff0c;有问必答&#xff01; 此文章来自链客区块链技术问答社区&#xff0c;未经允许拒绝转载。 区块链未来3到5年应该会出现职业井喷式开展&#xff0c;相应所需的人才必定水涨船高&#xff0c;每一个开发人员都不应该错失这样的时机。 …

python之CSV文件格式

1、csv文件是以一些以逗号分隔的值 import csv filename "wenjian.csv" with open(filename) as f:reader csv.reader()header next(reader)for index,column in enumerate(header):#enumerate函数获取每个元素的索引及其值print(index,column) 转载于:https://ww…

连信的protobuf数据格式

点击上方↑↑↑蓝字[协议分析与还原]关注我们“ 连信里用到的protobuf结构。”在看本文之前&#xff0c;可以先进行一下回顾&#xff0c;之前已经对协议的框架进行了整体的介绍&#xff1a;连信协议整体框架看了后结合自己的分析过程&#xff0c;应该有个初步的了解。后续会陆续…

Caused by: org.xml.sax.SAXParseException: 不允许有匹配 [xX][mM][lL] 的处理指令目标。

版权声明&#xff1a;本文为 testcs_dn(微wx笑) 原创文章&#xff0c;非商用自由转载-保持署名-注明出处&#xff0c;谢谢。 https://blog.csdn.net/testcs_dn/article/details/81001749 Caused by: org.xml.sax.SAXParseException: 不允许有匹配 "[xX][mM][lL]" 的处…

区块链的共识算法

链客&#xff0c;专为开发者而生&#xff0c;有问必答&#xff01; 此文章来自链客区块链技术问答社区&#xff0c;未经允许拒绝转载。 共同算法11 是经过特殊节点的投票&#xff0c;在短时间内完成对买卖的承认&#xff0c;假如利益不相干的若干个节点达到共同&#xff0c…

php的基础知识(四)

14、数组&#xff1a; 索引数组&#xff1a; 下标就是数字开始的。 $arr [a,b,c,1,2,3]; 关联数组&#xff1a; $arr [ a > b, c > d; e > f ]; 二维数组&#xff1a; 关联和索引混合的。 $arr [ a, b, c, d > [ e > h, f, g ], i, ]; 三维数组和多维数组。 …

如何使用Python和Tkinter构建Toy Markdown编辑器

Markdown editors are trending these days. Everybody is creating a markdown editor, and some of them are innovative while some of them are boring. Markdown编辑器近来呈趋势。 每个人都在创建降价编辑器&#xff0c;其中有些人很创新&#xff0c;而有些人很无聊。 A…

修改centos7的网卡名

1. 使用命令修改网卡名 cd /etc/sysconfig/network-scripts/ mv ifcfg-ens33 ifcfg-eth0 mv ifcfg-ens34 ifcfg-eth1 2. 修改网卡内容 cat > ifcfg-eth0<<END TYPEEthernet BOOTPROTOnone DEFROUTEyes IPV4_FAILURE_FATALno NAMEeth0 DEVICEeth0 ONBOOTyes IPADDR1…