iOS 用For循环实现九宫格的实现
来源:互联网 发布:网络直播涉黄 编辑:程序博客网 时间:2024/05/16 19:09
// 总列数 int totalColumns = 3; // 每一格的尺寸 CGFloat cellW = 50; CGFloat cellH = 50; // 间隙 CGFloat margin =(self.view.frame.size.width - totalColumns * cellW) / (totalColumns + 1); // 根据格子个数创建对应的框框 for(int index = 0; index< self.array.count; index++) { UIView *cellView = [[UIView alloc ]init ]; cellView.backgroundColor = [UIColor blueColor]; // 计算行号 和 列号 int row = index / totalColumns; int col = index % totalColumns; //根据行号和列号来确定 子控件的坐标 CGFloat cellX = margin + col * (cellW + margin); CGFloat cellY = row * (cellH + margin); cellView.frame = CGRectMake(cellX, cellY, cellW, cellH); // 添加到view 中 [self.view addSubview:cellView]; }
0 0
- iOS 用For循环实现九宫格的实现
- ios九宫格实现
- iOS实现九宫格
- iOS for循环创建九宫格
- iOS实现九宫格效果
- iOS 实现九宫格效果
- IOS 九宫格实现思路
- iOS就九宫格实现
- 九宫格的实现
- iOS 6 新特新CollectionView的使用实现九宫格
- iOS 6 新特新CollectionView的使用实现九宫格
- iOS之OC随笔-九宫格的算法简单实现
- 实现iOS系统相机九宫格滤镜的思路
- android九宫格的实现
- android的九宫格实现
- android 九宫格的实现
- 九宫格的实现算法
- 【Android】九宫格的实现
- linux下第三方库(ZThread)的安装,eclipse配置
- Android webview 使用
- 使用nginx+nginx-rtmp-module+ffmpeg搭建流媒体服务器笔记(五)
- ios应用打包测试之如何生成.mobileprovision文件
- .net framework 25007 error
- iOS 用For循环实现九宫格的实现
- CI 工具
- IIS添加虚拟目录后无法启动问题
- log4net:ERROR XmlConfigurator:
- cruiseControl.net 配置总结
- 0x8007007E 错误解决
- Siebel training kick off
- poj 1204 trie树/AC自动机(在二维词表中找词)
- DBDesigner与MySQL5兼容问题