WLCardViewLayout 0.2.0

WLCardViewLayout 0.2.0

测试已测试
语言语言 Obj-CObjective C
许可 MIT
发布时间最后发布2016年2月

HotWordland维护。



  • 作者
  • 巫龙

使用

要运行示例项目,克隆存储库,并首先从示例目录运行pod install

所需条件

安装

WLCardViewLayout通过CocoaPods提供。要安装它,只需将以下行添加到Podfile

pod "WLCardViewLayout"

效果

使用

在可视化编辑里:

然后将cardlayout关联至Controller

@property (weak, nonatomic) IBOutlet WLCardViewLayout *cardLayout;
- (void)viewDidLoad {
[super viewDidLoad];
[self.cardLayout setSwipeToDeleteDelegate:self];
}

//CollectView数据源代理 

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return 1;
}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return list.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{

UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"CardCell" forIndexPath:indexPath];
UIImageView *im = [cell viewWithTag:100];
[im setImage:[UIImage imageNamed:list[indexPath.section]]];
return cell;
}


//swipe删除数据源代理

-(void)swipeToDeleteLayout:(WLCardViewLayout *)layout didDeleteCellAtIndexPath:(NSIndexPath *)indexPath{
[list removeObjectAtIndex:indexPath.section];
}

作者

巫龙, [email protected]

许可

WLCardViewLayout可根据MIT许可使用。有关更多信息,请参阅LICENSE文件。