美文网首页ios
POP的使用

POP的使用

作者: Mr丶炎 | 来源:发表于2016-05-27 16:53 被阅读82次

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];

相关文章

网友评论

    本文标题:POP的使用

    本文链接:https://www.haomeiwen.com/subject/ebhfdttx.html