I am doing this to learn how to work with the Core Animation properties on iPhone (not to learn how to cross-photograph images as such).
Reading such questions in SO makes me think that this can be done by animating the .contents property of the UIImageView level , eg:
UIImage *image1 = [UIImage imageNamed:@"someImage1.png"]; UIImage *image2 = [UIImage imageNamed:@"someImage2.png"]; self.imageView.image = image1; [self.view addSubview:self.imageView]; CABasicAnimation *crossFade = [CABasicAnimation animationWithKeyPath:@"contents"]; crossFade.duration = 5.0; self.imageView.layer.contents = image2; [self.imageView.layer addAnimation:crossFade forKey:@"animateContents"];
I received the item incorrectly or is not possible.
Update: The above code creates an empty UIImageView. When I change this line:
self.imageView.layer.contents = image2.CGImage;
... Now I see the image, but it does not disappear, it just appears instantly.
iphone core-animation
willc2 Oct 11 '09 at 8:52 2009-10-11 08:52
source share