I wanna make a layer rotate and the code is like this :
weightHand.bounds = CGRectMake(0,0,w,h);
weightHand.anchorPoint = CGPointMake(GET_COEFF(QCETEK_WHAT_UNITS, WEIGHTHANDE_APX_INDEX),
GET_COEFF(QCETEK_WHAT_UNITS, WEIGHTHANDE_APY_INDEX));
weightHand.transform = CATransform3DMakeRotation (SCALE_INIT_DEGREE , 0, 0, 1);
With the code , the weightHand truly rotates. But now I wanna know when the rotation animation is done. I hope to continue to rotate it when the previous rotation is completed.
I suppose there might be some delegate that can be invoked at the right time during the procedure of the animation , saying beginning or done .
Please help to enlighten me on the information. Thanks a lot. [edited]:Code is pasted.
if ( !bStopped ) {
[data_queue addObject:[NSNumber numberWithDouble:dbWeight]] ;
NSLog(@"Qu") ;
}
else {
NSLog(@"Con") ;
}
bStopped = NO ;
[UIView animateWithDuration:1 animations:^{
weightHand.transform = CATransform3DMakeRotation (CONVERT_TO_DISPLAY_FROM_KG(dbWeight), 0, 0, 1);
} completion:^(BOOL finished) {
if ( finished ) {
NSLog(@"Done") ;
bStopped = YES ;
if ( [data_queue count] == 0 ) return ;
double dbLocalWeight = [[data_queue objectAtIndex:0] doubleValue];
[data_queue removeObjectAtIndex:0];
[self setMainAnimation:dbLocalWeight] ;
}
}];
the log is like this: 2013-12-05 22:10:49.524 Scale_Lite[969:60b] Con 2013-12-05 22:10:49.530 Scale_Lite[969:60b] Done 2013-12-05 22:10:49.674 Scale_Lite[969:60b] Con 2013-12-05 22:10:49.680 Scale_Lite[969:60b] Done 2013-12-05 22:10:49.724 Scale_Lite[969:60b] Con 2013-12-05 22:10:49.730 Scale_Lite[969:60b] Done 2013-12-05 22:10:49.924 Scale_Lite[969:60b] Con 2013-12-05 22:10:49.930 Scale_Lite[969:60b] Done