views:

101

answers:

1

Hello, 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"];
A: 

Try using:

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

insteaad of:

[animation setTimingFunction:UIViewAnimationCurveEaseInOut];
glorifiedHacker
Doens´t work. The strange thing is that my code works with self.view layer, but not with animationImage layer…
Flocked
I must be missing something then, because UIImageView inherits from UIView, so you should be able to add animations to its layer.
glorifiedHacker