Question

hi is there any way to set image [uiimage image named@"abc.png"] with the motion effect means the image should not be changed at once , it need to change with very slow motion effect so that user can see that image is now changing .

Thanks in advance

Was it helpful?

Solution

* Method one to perform the Animation *

Step 1 : Add following framework in your project and import it to your .m file

#import <QuartzCore/QuartzCore.h>

Step 2 : Write following code in your ImageChange method

imageView.image = [UIImage imageNamed:@"newImage.jpg"];

CATransition *transition = [CATransition animation];
transition.duration = 1.0f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionFade;

[imageView.layer addAnimation:transition forKey:nil];

* Method Two to perform the Animation *

[UIView transitionWithView:YourImageView
              duration:0.2f
               options:UIViewAnimationOptionTransitionCrossDissolve
            animations:^{
                YourImageView.image = newImage;
            } completion:NULL];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top