0
votes

I am trying to animate one of my image form bottom to Top of my screen , for that i am implementing an animation that the current width and height of image will become half during the transition stage and will take its original size once animation completes.

The issue is once the 1st animation is done it hold's for a while and then starts another animation , i want a smooth animation .

Here is the code :

[UIView animateWithDuration:1.0
                          delay:0.5
                        options:UIViewAnimationOptionTransitionCurlUp
                     animations:^{

                              [_myImageView setFrame:CGRectMake(20.0, 220.0, currentframe.size.width/2, currentframe.size.height/2)];

                          } completion:^(BOOL finished)
                            {
                              if (finished)
                              {
                                  [UIView animateWithDuration:1.0
                                                        delay:0
                                                      options:UIViewAnimationOptionBeginFromCurrentState
                                                   animations:^{
                                                       [_myImageView setFrame:CGRectMake(20.0, 20.0, currentframe.size.width, currentframe.size.height)];


                                                   } completion:^(BOOL finished) {
                                                       if (finished) {
                                                           NSLog(@"2 nd log ");
                                                       }
                                                   }];

                                  NSLog(@"animation fisnished !!");
                              }
                          }];

What should be done ?

1
I don't see any lag in your code.. Where is it lagging? After reaching y=220?GenieWanted
On which hardware are you testing? are you doing some concurrent work during the animation? are you using the main thread for it?pdrcabrod
yup @GenieWanted when i reach y = 220 it lags for while and this animation happens when i button is pressed.vinay chorpa

1 Answers

0
votes

try this:

[UIView animateWithDuration:1.0
                      delay:0
                    options:UIViewAnimationOptionCurveLinear// use CurveLinear option
                 animations:^{

                 } completion:^(BOOL finished) {

                 }];