2

I have an NSArray *pictureRefs which contains names of pictures.

These pictures are to be displayed in UIImageView _mainImage Which works fine so far.
At the moment I´m using the buttons on the left and right to do so, see picture below. The buttons have tags which correspond with pictureRefs.

The change takes place very straight without any effects.
I would like to implement coverflow like animations.

Any ideas how I could achieve this?

My code to switch image

string =  [pictureRefs objectAtIndex:tag];
UIImage  *image  = [UIImage imageNamed:string];
[_mainImage setImage:image]; //Here I would like to make animations

enter image description here

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Ronald Hofmann
  • 1,390
  • 2
  • 15
  • 26
  • http://stackoverflow.com/a/2834693/1990236 this should help – Arek Holko Oct 12 '13 at 13:00
  • http://stackoverflow.com/questions/7638831/fade-dissolve-when-changing-uiimageviews-image/38350024#38350024 – Kumar KL Jul 13 '16 at 11:28
  • Possible duplicate of [How to animate the change of image in an UIImageView?](http://stackoverflow.com/questions/2834573/how-to-animate-the-change-of-image-in-an-uiimageview) – JMI Jul 13 '16 at 11:34

1 Answers1

2

call this method when clicked on any button

-(void)check_changeImage:(NSInteger)Value
{
    NSString *strimagename=[NSString stringWithFormat:@"dice_0%d.png",Value];//fetch image here as per you want 

 [UIView animateWithDuration:1.0 
                 animations:^{
                     imgviewDice1.image.alpha = 1.0;
                 }
                 completion:^(BOOL finished){

                     imgviewDice1.image=[UIImage imageNamed:strimagename];

                     // do something after the animation finished, 
                     // maybe releasing imageA if it's not used anymore...
                 }];

}

may be it will help.

Dev Patel
  • 290
  • 1
  • 9