objective c - UIView AnimateKeyFrames All At Once -
why of nslogs being run @ once?
my understanding each 1 should separated 1 second. incorrect?
[uiview animatekeyframeswithduration:5.0 delay:0.0 options:0 animations:^{ [uiview addkeyframewithrelativestarttime:0.0 relativeduration:1 animations:^{ nslog(@"1"); }]; [uiview addkeyframewithrelativestarttime:1 relativeduration:1 animations:^{ nslog(@"2"); }]; [uiview addkeyframewithrelativestarttime:2 relativeduration:1 animations:^{ nslog(@"3"); }]; [uiview addkeyframewithrelativestarttime:3 relativeduration:1 animations:^{ nslog(@"4"); }]; [uiview addkeyframewithrelativestarttime:4 relativeduration:1 animations:^{ nslog(@"5"); }]; [uiview addkeyframewithrelativestarttime:5 relativeduration:1 animations:^{ nslog(@"6"); }]; } completion:nil];
here log:
2015-03-28 14:10:52.409 appname[636:80664] 1 2015-03-28 14:10:52.409 appname[636:80664] 2 2015-03-28 14:10:52.409 appname[636:80664] 3 2015-03-28 14:10:52.409 appname[636:80664] 4 2015-03-28 14:10:52.410 appname[636:80664] 5 2015-03-28 14:10:52.410 appname[636:80664] 6
your relativestarttime wrong, value should 0.0 1.0, percentage of whole duration.
please see apple's comments function:
start time , duration values between 0.0 , 1.0 specifying time , duration relative overall time of keyframe animation
or
the time @ start specified animations. value must in range 0 1, 0 represents start of overall animation , 1 represents end of overall animation. example, animation 2 seconds in duration, specifying start time of 0.5 causes animations begin executing 1 second after start of overall animation.
ref: see more
Comments
Post a Comment