int totalColumns = 17;//总共的个数
int cellCount = 5; //每一行的个数
CGFloat topY = 50; //距离上面的距离
CGFloat iconW = 45;
CGFloat iconH = 45;
CGFloat marginX = (self.view.frame.size.width - cellCount * iconW) / (cellCount + 1)-2;
CGFloat marginY = 10;
for (int i = 0; i< totalColumns; i++) {
int row=i/cellCount;
int col=i%cellCount;
CGFloat iconX = marginX + 5 + col * (iconW + marginX);
CGFloat iconY = topY + row * (iconH + marginY);
UIImageView *iconImgView=[[UIImageView alloc]initWithFrame:CGRectMake(iconX, iconY, iconW, iconH)];
iconImgView.backgroundColor = [UIColor blueColor];
[self.view addSubview:iconImgView];
int cellCount = 5; //每一行的个数
CGFloat topY = 50; //距离上面的距离
CGFloat iconW = 45;
CGFloat iconH = 45;
CGFloat marginX = (self.view.frame.size.width - cellCount * iconW) / (cellCount + 1)-2;
CGFloat marginY = 10;
for (int i = 0; i< totalColumns; i++) {
int row=i/cellCount;
int col=i%cellCount;
CGFloat iconX = marginX + 5 + col * (iconW + marginX);
CGFloat iconY = topY + row * (iconH + marginY);
UIImageView *iconImgView=[[UIImageView alloc]initWithFrame:CGRectMake(iconX, iconY, iconW, iconH)];
iconImgView.backgroundColor = [UIColor blueColor];
[self.view addSubview:iconImgView];
}