iphone - UIView animateWithDuration not animating when duration changes -


i have method named

- (void) startanimationfortime : (nsnumber* ) time { 

which call other place in code. works first time call method, when call other time duration still animates previous time duration. animation speed not change. suppose call method first time...

[self performselectoronmainthread:@selector(startanimationfortime:) withobject:[nsnumber numberwithfloat:20.0] waituntildone:no]; 

and if call other place as,

[self performselectoronmainthread:@selector(startanimationfortime:) withobject:[nsnumber numberwithfloat:10.0] waituntildone:no]; 

the animation speed expected change, doesn't. i'm posting animation method here...

in other method in code,

  animator1 = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"beach_bg.png"]];   animator2 = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"beach_bg.png"]];    animator1.frame = cgrectmake(0,-bgheight,320,bgheight);   animator2.frame = cgrectmake(0,0,320,bgheight);    - (void) startanimationfortime : (nsnumber*) time {      animator1 = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"beach_bg.png"]];     animator2 = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"beach_bg.png"]];      [self.view addsubview:animator1];     [self.view addsubview:animator2];     [self.view addsubview:playtime];     [self.view addsubview:pausebutton];     [self.view addsubview:bgimageview];      animator1.frame = cgrectmake(0,-bgheight,320,bgheight);     animator2.frame = cgrectmake(0,0,320,bgheight);      [uiview animatewithduration:[time floatvalue]                           delay:0.0                         options:uiviewanimationoptionrepeat | uiviewanimationoptioncurvelinear                      animations:^{                          animator2.transform = cgaffinetransformmaketranslation(0, bgheight);  }                      completion:^(bool fin) { if (fin){}}];      [uiview animatewithduration:[time floatvalue]                           delay:0.0                         options:uiviewanimationoptionrepeat | uiviewanimationoptioncurvelinear                      animations:^{                          animator1.transform = cgaffinetransformmaketranslation(0, bgheight);  }                      completion:^(bool fin) { if (fin){}}];  } 

i tried second time call method,

animator1.frame = [[animator1.layer presentationlayer]frame];  animator2.frame = [[animator2.layer presentationlayer]frame]; 

this me current frame of animator1 , animator2. doesn't work either. i'm badly stuck @ this..

any appreciated....

thanks in advance..

please put code before

 animator1.frame = cgrectmake(0,-bgheight,320,bgheight);     animator2.frame = cgrectmake(0,0,320,bgheight); 

this

[self.view addsubview:animator1];     [self.view addsubview:animator2];     [self.view addsubview:playtime];     [self.view addsubview:pausebutton];     [self.view addsubview:bgimageview]; 

and try animate. hope helps


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -