Sunday 15 April 2012

ios - how to pause uiview animation? -



ios - how to pause uiview animation? -

how pause uiview animation , leave there?

//#define animation_worm_options (uiviewanimationoptioncurvelinear| // uiviewanimationoptionbeginfromcurrentstate) - (ibaction)pressup:(id)sender { [self.game wormup]; [self.gamescene.wormview.layer removeallanimations]; [uiview animatewithduration:5 delay:0 options:animation_worm_options animations:^{ [self.gamescene.wormview moveup]; } completion:^(bool finished) { }]; } - (ibaction)pressright:(id)sender { [self.game wormright]; [uiview animatewithduration:5 delay:0 options:animation_worm_options animations:^{ [self.gamescene.wormview moveright]; } completion:^(bool finished) { }]; }

an example:

here going do.

when first pressright worm goes right.

then when pressup during worm goes right, worm should stop , goes up.

the problem in code removeallanimations first set worm end of

first animation end, begin goes up.

you need alter view's frame halting position frame. add together next before removeallanimation on view.layer.

self.theview.frame = [self.theview.layer.presentationlayer frame];

ios objective-c animation uiview

No comments:

Post a Comment