To run the example project, clone the repo, and run pod install
from the Example directory first.
WLCardViewLayout is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "WLCardViewLayout"
#支持cocoapods
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];
}
巫龙, 454763196@qq.com ##LonLonStudio - WL -(重庆开发者巫龙 ^_^) http://codercq.com/
WLCardViewLayout is available under the MIT license. See the LICENSE file for more info.