ios - Unwanted blinking in animation -
-(ibaction)duckaction:(id)sender{ cabasicanimation *moveduck = [cabasicanimation animationwithkeypath:@"position"]; [moveduck setremovedoncompletion:yes]; [moveduck setduration:.40]; [moveduck setrepeatcount:1]; [moveduck setautoreverses:no]; [moveduck setfromvalue:[nsvalue valuewithcgpoint: cgpointmake(btnduck.center.x+25 ,btnduck.center.y)]]; [moveduck settovalue:[nsvalue valuewithcgpoint: cgpointmake(btnduck.center.x -25, btnduck.center.y)]]; [btnduck.layer addanimation:moveduck forkey:@"position"]; } -(ibaction)frogaction:(id)sender{ ptfrog = btnfrog.center; [uiview animatewithduration:1.00 delay:0.0 options:(uiviewanimationoptionautoreverse|uiviewanimationoptionallowuserinteraction) animations:^ { cgpoint position; position.y = 577.0f; position.x = 58.0f; btnfrog.center = position; } completion:^(bool finished){ btnfrog.center = ptfrog; }]; }
i have 2 buttons close each other. first press frog button press duck button @ end of frog animation there blink in frog button. not know why happening? how remove blinking?
remove line in completion block dude.
btnfrog.center = ptfrog;
after animation completed center it.that reason blinking. if want set center put above code in animations block
updates:
-(ibaction)frogaction:(id)sender{ ptfrog = btnfrog.center; [uiview animatewithduration:1.00 delay:0.0 options:(uiviewanimationoptionautoreverse|uiviewanimationoptionallowuserinteraction) animations:^ { cgpoint position; position.y = 577.0f; position.x = 58.0f; //btnfrog.center = position; btnfrog.center = ptfrog; } completion:^(bool finished){ }]; }
Comments
Post a Comment