Thursday 15 March 2012

ios - Cancel UIAnimation without removing UIView -



ios - Cancel UIAnimation without removing UIView -

i have animation block moves uiimageview top of screen bottom. if user taps screen @ point during animation, want uiimageview stop in it's place.

currently, have

[uiview animatewithduration:3 delay:0 options:uiviewanimationoptioncurvelinear animations:^(void){ [self.myimage setcenter:cgpointmake(self.view.frame.size.width/2,self.view.frame.size.height-20)]; }]; [self.view.layer removeallanimations];

but removeallanimations doesn't stop uiimageview animating...

starting new animation 0.0 duration cancel previous , start new one. might nil , maintain uiimageview @ point user stopped it:

[uiview animatewithduration:0.0 delay:0.0 options:uiviewanimationoptionbeginfromcurrentstate animations:^{redview.frame = ((calayer *)redview.layer.presentationlayer).frame;} completion:^(bool finished){ [catransaction begin]; [redview.layer removeallanimations]; [catransaction commit]; }];

beginfromcurrent state lets take image @ place.

ios objective-c

No comments:

Post a Comment