Skip to content

dyy1993/DYWaterflowLayout

Repository files navigation

DYWaterflowLayout

============== CocoaPods  CocoaPods 

###简单的瀑布流布局

Installation【安装】

From CocoaPods【使用CocoaPods】

pod 'DYWaterflowLayout'

Manually【手动导入】

  • Drag all source files under floder DYWaterflowLayout to your project.【将DYWaterflowLayout文件夹中的所有源代码拽入项目中】
  • Import the main header file:#import "DYWaterflowLayout.h"【导入主头文件:#import "DYWaterflowLayout.h"

##使用 #####创建布局

DYWaterflowLayout *layout = [[DYWaterflowLayout alloc] init];
layout.delegate = self;
UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout];
    

#####实现代理

- (CGSize)waterflowLayout:(DYWaterflowLayout *)waterflowLayout heightForItemAtIndexPath:(NSIndexPath *)indexPath
{
  //返回对应图片的大小
   return [self.imageSizes[indexPath.item % 7] CGSizeValue];
}
    

Demo

About

💦 简单的瀑布流布局

Resources

License

Stars

Watchers

Forks

Packages

No packages published