计算行数 计算frame的x、y

如果每行显示4个按钮

count是数据总数

行数计算为:btnRowCount = (count - 1) / 4 + 1;

行间隔数:btnRowCount - 1

子视图frame计算时

x : (i % 4) * (子视图宽度 + 列间隔)

y :(i / 4) * (子视图高度+ 行间隔)

猜你喜欢

转载自blog.csdn.net/allanGold/article/details/81950814