DDCardView 1.0.1

DDCardView 1.0.1

sanli 维护。



  • 来自
  • DDStrongman

DDCardView

示例

类似于QQ卡片封装的双面卡片View,可设置正反双面,点击产生翻面动画,卡片自带阴影和圆角
一行代码即可生成想要的双面动效卡片View

img

实例函数:

/**
 生成双面cardView

 @param frame frame
 @param front 正面,可以传入image,string或者view
 @param back 反面,可以传入image,string,nil或者view
 @param tapBlock 点击block,处理翻转,传回idBack状态和view
 @return 返回生成的双面cardview
 */
- (instancetype)initWithFrame:(CGRect)frame
                        front:(__nonnull id)front
                         back:(__nullable id)back
                     tapBlock:(void(^)(BOOL isBack,UIView *tapView))tapBlock

举个例子:

    UIView *test = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];
    test.backgroundColor = [UIColor blackColor];
    
    UIView *testTwo = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];
    testTwo.backgroundColor = [UIColor blackColor];
    
    
    DDCardView *testCard = [[DDCardView alloc]initWithFrame:CGRectMake(10, 10, 200, 200) 
                            front:test 
                            back:testTwo
                            tapBlock:^(BOOL isBack, UIView * _Nonnull tapView) { 
    }];
    [self.view addSubview:testCard];

需求

直接加载网络图片URL依赖于SDWebimage

安装

HttpSupportSpec可以通过CocoaPods获取。要安装它,只需将以下行添加到Podfile中即可

pod 'DDCardView'

作者

DDStrongman, [email protected]

许可证

DDCardView在MIT许可下可用。有关更多信息,请参阅LICENSE文件。