左右滑动卡片
#import "CAAnimation+Blocks.h"
@interface CAAnimation (BlocksAddition)
@property (nonatomic, copy) void (^completion)(BOOL finished);
@property (nonatomic, copy) void (^start)(void);
- (void)setCompletion:(void (^)(BOOL finished))completion; // Forces auto-complete of setCompletion: to add the name 'finished' in the block parameter
CABasicAnimation代码块block回调代码,例如:
CABasicAnimation *anotherAnimation = [CABasicAnimation animationWithKeyPath:@"position.x"];
anotherAnimation.fromValue = @(self.anotherImageView.layer.position.x);
anotherAnimation.toValue = @(FF_SCREEN_WIDTH);
anotherAnimation.duration = 1;
[anotherAnimation setCompletion:^(BOOL finished) {
[self animationRepeat];
}];
[self.anotherImageView.layer addAnimation:anotherAnimation forKey:@"1"];