文章来源:淘论文网   发布者: 毕业设计   浏览量: 38



还可以点击去查询以下关键词:
[瀑布]    [毕业]    [collectionView]    [瀑布流-毕业collectionView]   

项目介绍:

ImageLayout

瀑布流,开题报告,网络图片瀑布流

GitHub: https://github.com/Zws-China/ImageLayout

How To Use #import 'WSLayout.h' @property (strong, nonatomic) UICollectionView *collectionView; @property (strong, nonatomic) WSLayout *wslayout; self.wslayout = [[WSLayout alloc] init]; self.wslayout.lineNumber = 2; //列数 self.wslayout.rowSpacing = 5; //行间距 self.wslayout.lineSpacing = 5; //列间距 self.wslayout.sectionInset = UIEdgeInsetsMake(5, 5, 5, 5); //内边距 // 透明时用这个属性(保证collectionView 不会被遮挡, 也不会向下移) //self.edgesForExtendedLayout = UIRectEdgeNone; // 不透明时用这个属性 //self.extendedLayoutIncludesOpaqueBars = YES; self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height-64) collectionViewLayout:self.wslayout]; [self.collectionView registerClass:[WSCollectionCell class] forCellWithReuseIdentifier:@'collectionCell']; self.collectionView.dataSource = self; self.collectionView.delegate = self; self.collectionView.backgroundColor = [UIColor lightGrayColor]; [self.view addSubview:self.collectionView]; //返回每个cell的高 对应indexPath [self.wslayout computeIndexCellHeightWithWidthBlock:^CGFloat(NSIndexPath *indexPath, CGFloat width) { CellModel *model = modelArray[indexPath.row]; CGFloat oldWidth = model.imgWidth; CGFloat oldHeight = model.imgHeight; CGFloat newWidth = width; CGFloat newHeigth = oldHeight*newWidth / oldWidth; return newHeigth; }]; #pragma mark - UICollectionViewDataSource - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 1; } - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return modelArray.count; } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { WSCollectionCell *cell = (WSCollectionCell *)[self.collectionView dequeueReusableCellWithReuseIdentifier:@'collectionCell' forIndexPath:indexPath]; cell.model = modelArray[indexPath.row]; return cell; }

开题报告


这里还有:


还可以点击去查询:
[瀑布]    [毕业]    [collectionView]    [瀑布流-毕业collectionView]   

请扫码加微信 微信号:sj52abcd


下载地址: http://www.taolw.com/down/8064.docx
  • 上一篇:【Swift】Anim定制atedTransitionGallery
  • 下一篇:SRPictureBrowser