Saturday, 15 September 2012

ios - Animation is very unpredictable with animateWithDuration -



ios - Animation is very unpredictable with animateWithDuration -

this question asked lot of people have not found reply it.

i have class within many other methods animation

someclass.m @implementation ////.. -(void) someanimationwithsomeobject (someparameters...blablabla [uiview animatewithduration:0.2f delay:delay options:uiviewanimationoptioncurveeaseout animations:^ { self.center = point; self.transform = cgaffinetransformmakerotation(_angle); } completion:nil)];

in viewcontroller

-(void) somemethod1 { /..... (int i=0; < count; i++) { /...some operation coordinates [self.cardcontainer addsubview:someview]; [someview someanimationwithsomeobject:someparameters withdelay:delay]; delay += 0.2f; /... }

[self somemethod2];

} -(void) somemethod2 { /..... (int i=0; < count; i++) { /...some operation coordinates [self.cardcontainer addsubview:someview]; [someview someanimationwithsomeobject:someparameters withdelay:delay]; delay += 0.2f; /... } } - (void)viewdidload { [super viewdidload]; [self somemethod1]; }

when utilize code animation unpredictable, because when phone call somemethod2 calculation of coordinates fastest animation.

how create animation play in first method , in sec in etc.

[solved]

after somemethod1 adding

[self performselector:@selector(somemethod2) withobject:nil afterdelay:delay];

and need correction delay + or -

it's done!

consider starting sec method in completion block of first. is, "do animation; then, when it's finished, phone call somemethod2 , start next animation.

ios xcode cocoa uiview

No comments:

Post a Comment