项目介绍:
CCDraggableCard
https://github.com/liuzechen/CCDraggableCard-Master
CCDraggableCard是左滑无感|右滑喜欢的卡牌视图。作者会不间断更新,如CCDraggableCard有幸被您搜到,请Star予以支持(^__^) ……
使用
CCDraggableCard中主视图CCDraggableContainer的使用类似UITableView, 拥有CCDraggableContainerDelegate和CCDraggableContainerDataSource对CardView进行操作。
1.CCDraggableContainer初始化
[Objective-C] 查看源文件 复制代码
@property (nonatomic, strong) CCDraggableContainer *container; self.container = [[CCDraggableContainer alloc] initWithFrame:... style:CCDraggableStyleUpOverlay]; self.container.delegate = self; self.container.dataSource = self; [self.view addSubview:self.container];
2.刷新数据[Objective-C] 查看源文件 复制代码
[self.container reloadData];
3.协议
CCDraggableContainerDataSource
[Objective-C] 查看源文件 复制代码
- (CCDraggableCardView *)draggableContainer:(CCDraggableContainer *)draggableContainer viewForIndex:(NSInteger)index; - (NSInteger)numberOfIndexs;
CCDraggableContainer Delegate
[Objective-C] 查看源文件 复制代码
- (void)draggableContainer:(CCDraggableContainer *)draggableContainer draggableDirection:(CCDraggableDirection)draggableDirection widthRatio:(CGFloat)widthRatio heightRatio:(CGFloat)heightRatio; - (void)draggableContainer:(CCDraggableContainer *)draggableContainer cardView:(CCDraggableCardView *)cardView didSelectIndex:(NSInteger)didSelectIndex; - (void)draggableContainer:(CCDraggableContainer *)draggableContainer finishedDraggableLastCard:(BOOL)finishedDraggableLastCard;
版本及功能
v.1.0
CCDraggableContainer通过代码创建卡牌(滑动距离、左右方向、点击)
DEMO 直接下载: