ios8 - Objective-C- animateWithDuration Completion block called early -
ios8 - Objective-C- animateWithDuration Completion block called early -
before discredit question beingness asked before, please @ details:
i have simple animation of shrinking frame of view it's normal size 0 frame in middle of superview. in completion block remove superview superview , remove view controller parent view controller. completion block called immediately. moreover, bool
parameter finished
completion block equals yes
. when check if animation finished says when it's not , view prematurely removed. here code:
- (void)closewindow { [uiview animatewithduration:0.5 animations:^{ contentview.frame = [self getschoolsetupstartingframe]; } completion:^(bool finished){ if(finished) { [self.view removefromsuperview]; [self removefromparentviewcontroller]; } }]; } - (cgrect)getschoolsetupstartingframe { cgrect startingframe; cgrect myframe = self.view.frame; float xpos = (myframe.origin.x + (myframe.size.width/2)); float ypos = (myframe.origin.y + (myframe.size.height/2)); startingframe = cgrectmake(xpos, ypos, 0, 0); homecoming startingframe; }
is there else related problem haven't considered yet? appreciate help.
i'd seek changing animation duration .5f
, , verify contentview
not nil during animation block.
also, might easier accomplish animation using transform
animations:^{ contentview.transform = cgaffinetransformmakescale(.1f, .1f); }
objective-c ios8
Comments
Post a Comment