模仿 iOS7 task switcher 的卡片动画

1,168 阅读1分钟

Introduction

This is animation is imitate iOS7 task switcher animation, if you have more than 4 cards,it will reues card,and it can delete card

Gif

how to use

1.add card scroll view

self.cardScrollView = [[CardScrollView alloc] initWithFrame:self.view.frame];
self.cardScrollView.cardDelegate = self;
self.cardScrollView.cardDataSource = self;
[self.view addSubview:self.cardScrollView];

2.update card when scrolling

- (void)updateCard:(UIView *)card withProgress:(CGFloat)progress direction:(CardMoveDirection)direction;

3.set cards number

- (NSInteger)numberOfCards;

4.reuse card

- (UIView *)cardReuseView:(UIView *)reuseView atIndex:(NSInteger)index;

5.delete card,this is optional

- (void)deleteCardWithIndex:(NSInteger)index;