开发者

Why can I not add a animation to a UIImageView?

开发者 https://www.devze.com 2022-12-25 08:44 出处:网络
Im trying to add a animation to a UIImageView, but it always fails. Why? Here is the code: //(…) UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

Im trying to add a animation to a UIImageView, but it always fails. Why? Here is the code:

        //(…)
        UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();    
        animationImage = [[UIImageView alloc]initWithImage:newImage];
        [self.view addSubview:animationImag开发者_如何学Ce];

        CATransition *animation = [CATransition animation];
        [animation setDelegate:self];
        [animation setDuration:0.35];
        [animation setTimingFunction:UIViewAnimationCurveEaseInOut];
        animation.type = @"pageCurl";
        animation.fillMode = kCAFillModeForwards;
        animation.endProgress = 0.58;
        [animation setRemovedOnCompletion:NO];
        [[animationImage layer] addAnimation:animation forKey:@"pageCurlAnimation"];


Try using:

[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

insteaad of:

[animation setTimingFunction:UIViewAnimationCurveEaseInOut];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号