ZQCollectionView 1.0.1

ZQCollectionView 1.0.1

测试已测试
语言 Obj-CObjective C
许可证 自定义
发布上次发布2016年4月

张强维护。



  • 作者:
  • 张强

ZQ_CollectionView

水平集合视图

水平collectionView

这是一个可以横向排列并横向滚动的collectionView,您可以使用以下代码来运行:

ZQCollectionView* collectionV = [[ZQCollectionView alloc] initWithFrame:CGRectMake(0, 60, 300, 300) andHorizonNum:5 andVerticalNum:6 andScrollDirection:QCollectionScrollDirection_Horizontal andCollectionCellClass:[TestCollectionCell class]]; collectionV.collectionDelegate = self; [self.view addSubview:collectionV];

有几个属性可以设置:collectionBackgroundColor pagingEnabled bounces Delegate: 代理中的方法(之所以没有cellForItemAtIndexPath代理方法是因为在初始化方法“- (instancetype)initWithFrame:(CGRect)frame andHorizonNum:(int)horizonNumber andVerticalNum:(int)verticalNumber andScrollDirection:(QCollectionScrollDirection)qCollectionScrollDirection andCollectionCellClass:(Class)cellClass”中已经对一个section中的横向数量HorizonNum和纵向数量VerticalNum进行了设置):

(NSInteger)qNumberOfSectionsInCollectionView:(UICollectionView*)collection { return 10; }

(UICollectionViewCell)qCollectionView:(UICollectionView)collectionView cellForItemAtIndexPath:(NSIndexPath)indexPath { //cell是继承于UICollectionViewCell的子类,QCollectionCellReuseIdentity已在ZQCollectionView.h文件中定义 TestCollectionCell cell = [collectionView dequeueReusableCellWithReuseIdentifier:QCollectionCellReuseIdentity forIndexPath:indexPath]; return cell; }

(void)qCollectionView:(UICollectionView)collectionView didSelectItemAtIndexPath:(NSIndexPath)indexPath { }