1

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:animationImage]; 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"]; 

1 Answer 1

2

Try using:

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

insteaad of:

[animation setTimingFunction:UIViewAnimationCurveEaseInOut]; 
Sign up to request clarification or add additional context in comments.

3 Comments

Doens´t work. The strange thing is that my code works with self.view layer, but not with animationImage layer…
I must be missing something then, because UIImageView inherits from UIView, so you should be able to add animations to its layer.
@Flocked : dear try animationImage.layer and accept this answer as it helped me too.. :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.