iOS-创建9宫格代码
来源:互联网 发布:淘宝如何带客服新人 编辑:程序博客网 时间:2024/05/09 05:22
- (void)rankWithTotalColumns:(int)totalColumns andWithAppW:(int)appW andWithAppH:(int)appH{ //总列数 int _totalColumns = totalColumns; //view尺寸 CGFloat _appW = appW; CGFloat _appH = appH; //横向间隙 (控制器view的宽度 - 列数*应用宽度)/(列数 + 1) CGFloat margin = (self.view.frame.size.width - (_totalColumns * 85)) / (_totalColumns + 1);// for (int index = 0; index < self.appsArray.count; index++) { for (int index = 0; index < 5; index++) { //创建一个小框框// UIView *appView = [[UIView alloc] init]; appView.backgroundColor = [UIColor redColor]; //创建结束// //计算框框的位置...行号列号从0开始 //行号 int row = index / totalColumns; //行号为框框的序号对列数取商 //列号 int col = index % totalColumns; //列号为框框的序号对列数取余 // 每个框框靠左边的宽度为 (平均间隔+框框自己的宽度) CGFloat appX = margin + col * (appW + margin); // 每个框框靠上面的高度为 平均间隔+框框自己的高度 CGFloat appY = 30 + row * (appH + margin); appView.frame = CGRectMake(appX, appY, _appW, _appH); [self.view addSubview:appView]; }}
0 0
- iOS-创建9宫格代码
- iOS-创建9宫格代码
- IOS -- UIButton 代码创建
- 代码创建ios按键
- IOS UIButton 代码创建
- 代码创建IOS按钮
- IOS代码创建uinavigationcontroller
- [IOS]代码创建UINavigationController+UITabBarController
- iOS开发 代码创建UITabBarController
- iOS之代码创建button
- IOS 代码创建UI界面
- IOS---使用代码创建UIButton
- ios通过代码创建按钮
- iOS 设置界面(纯代码创建)
- ios-day02-02(通过代码创建按钮)
- 【iOS开发】使用代码创建UIButton
- IOS(swift)中用代码创建UI界面
- IOS 学习八 代码创建UIButton
- Hbase 行键设计(rowkey) 实现多条件查询
- Android 中 LocalSocket 使用
- 详细讲解Java中的IO流
- 基于vue2.0+正则表达式编写的插件
- @RequestParam @RequestBody @PathVariable 等参数绑定注解详解
- iOS-创建9宫格代码
- centos7 配置vsftpd,命令记录
- 【排序】基数排序
- angular.js依赖注入
- 自学iOS开发系列----UI(视图编程入门:ViewController、UIImageView、UILabel)
- 2)mysql 单表的增删改查,以及子查询,关联查询
- angularJS的$watch失效问题的解决方案
- MD5加密——3行代码
- NSCache