动画-图片旋转

旋转:
iv = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 300, 300)];
    [iv setImage:[UIImage imageNamed:@"dial_panel"]];
    //CALayer *rotate_layer = iv.layer;
    [self.view addSubview:iv];
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];
    animation.delegate = self;
    animation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI , 0, 0, 1.0)];
    animation.duration = 1;
    animation.cumulative = YES;
    animation.repeatCount = INT_MAX;
    animation.speed = 10;
    [iv.layer addAnimation:animation forKey:@"animation"];

暂定:
    CFTimeInterval pausedTime = [iv.layer convertTime:CACurrentMediaTime() fromLayer:nil];
    iv.layer.speed = 0.0;
    iv.layer.timeOffset = pausedTime;

猜你喜欢

转载自longquan.iteye.com/blog/1867795
今日推荐