iOS 瀑布流的简单用法
来源:互联网 发布:淘宝 中药材 真假 编辑:程序博客网 时间:2024/06/01 08:16
- (void)viewDidLoad{ [super viewDidLoad]; mainScrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds]; [self.view addSubview:mainScrollView]; pullArray = [NSMutableArray array]; [HttpRequset requsetForCurrentPage:1 completon:^(NSDictionary *responseDic) { NSLog(@"responseDic===%@",responseDic); NSDictionary * data = responseDic[@"data"]; NSArray * items = data[@"items"]; for (int i = 0; i < items.count; i ++) { PullModel * model = [[PullModel alloc] initWithJsonDic:items[i]]; [pullArray addObject:model]; } [self loadPullView]; }];}-(void)loadPullView{ //一维数组 分别代表左右两列 float colHeight[2] = {0.0,0.0}; for (PullModel * model in pullArray) { float height = [model.height floatValue]; float width = [model.width floatValue]; // NSLog(@"height=====%f,width====%f",height,width); //重新计算图片宽高 height =height * 150/width; width = 150; int index = colHeight[0] <= colHeight[1] ? 0 : 1; float x = index == 0 ? 0:160; float y = colHeight[index]; UIImageView * showImageView = [[UIImageView alloc] initWithFrame:CGRectMake(x, y, width, height)]; [showImageView sd_setImageWithURL:[NSURL URLWithString:model.picUrl]]; NSLog(@"model.url==%@",model.picUrl); [mainScrollView addSubview:showImageView]; colHeight[index] += height + 20; } float height = colHeight[0] <= colHeight[1] ? colHeight[1]:colHeight[0]; [mainScrollView setContentSize:CGSizeMake(320, height)];}
0 0
- iOS 瀑布流的简单用法
- iOS之简单瀑布流的实现
- iOS之简单瀑布流的实现
- iOS之简单瀑布流的实现
- iOS简单的瀑布流实现
- 【iOS开发】---- 瀑布流视图控件"quilt"的用法
- iOS瀑布流视图控件"quilt"的用法
- (iOS)简单的瀑布流布局
- IOS UICollectionView瀑布流 CHTCollectionViewWaterfallLayout用法
- [iOS]UITableView实现简单瀑布流
- ios让你简单实现瀑布流
- iOS之简单瀑布流-赵鹏举
- 一个简单的瀑布流
- javascript 简单的瀑布流
- jQuery简单的瀑布流
- 简单瀑布流的实现
- iOS瀑布流的实现
- UICollectionViewLayout的简单使用(简单瀑布流)
- 后台开发服务器系列
- spark streaming源码分析4 DStream相关API
- Java中的DatagramPacket与DatagramSocket的初步
- 【选择图片Jar】Adapter的实现之SparseBooleanArray图片状态管理器(二)
- 深入Java单例模式(转)
- iOS 瀑布流的简单用法
- 【ITOO】---对ViewModel进行去重操作
- iOS开发 之 WebView点击图片看大图效果
- uva11039
- Windows 无法启动 xxxx 服务 错误 14001
- iOS:UITextField协议的用法,键盘的隐藏,以及视图随着键盘的出现隐藏而上下调整位置
- Tomcat工作原理
- 《C和指针》摘录(一)
- [C++]exit & abort & 析构 & 异常