pop是facebook提供的动画框架
// 添加标题
UIImageView *sloganView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"app_slogan"]];
[self.view addSubview:sloganView];
// 添加动画
POPSpringAnimation *anim = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
CGFloat centerX = BSScreenW * 0.5;
CGFloat centerEndY = BSScreenH * 0.2;
CGFloat centerBeginY = centerEndY - BSScreenH;
anim.fromValue = [NSValue valueWithCGPoint:CGPointMake(centerX, centerBeginY)];
anim.toValue = [NSValue valueWithCGPoint:CGPointMake(centerX, centerEndY)];
// 这两个属性结合使用
anim.springBounciness = BSSpringFactor;
anim.springSpeed = BSSpringFactor;
anim.beginTime = CACurrentMediaTime() + BSCAnimationDelay * images.count;
[anim setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
// 标题动画执行完毕, 恢复点击
self.view.userInteractionEnabled = YES;
}];
[sloganView pop_addAnimation:anim forKey:nil];
网友评论