iphone - Synchronising the CCLayer & UIView animation -
i have added tableview subview [[ccdirector shareddirector]view] on cclayer. have animated cclayer & tableview separately following codes :
this code moves cclayer right & left.
-(void)movehomescreenlayerwithisanimated:(bool)_isanimationright{ if (!_isanimationright) { [mhomelayer runaction:[ccsequence actionone:[ccdelaytime actionwithduration:0.0f] two:[ccmoveto actionwithduration:0.4f position:ccp((size.width/4)*3, 0)]]]; } else{ [mhomelayer runaction:[ccsequence actionone:[ccdelaytime actionwithduration:0.0f] two:[ccmoveto actionwithduration:0.4f position:ccp(0, 0)]]]; } }
and tableview's animation:
-(void)viewanimationright{ [uiview cancelpreviousperformrequestswithtarget:self]; [uiview beginanimations:nil context:null]; [uiview setanimationduration:0.4f]; [uiview setanimationcurve:uiviewanimationcurveeaseinout]; tableviewhome.frame = cgrectmake(size.width - size.width/4,topbar.contentsize.height, size.width, size.height); [tableviewhome setscrollenabled:no]; [uiview commitanimations ]; } -(void)viewanimationleft{ [uiview cancelpreviousperformrequestswithtarget:self]; [uiview beginanimations:nil context:null]; [uiview setanimationduration:0.4f]; [uiview setanimationcurve:uiviewanimationcurveeaseinout]; tableviewhome.frame = cgrectmake(0, topbar.contentsize.height, size.width, size.height); [tableviewhome setscrollenabled:yes]; [uiview commitanimations ]; }
both cclayer & tableview gets animated, animations not synchronised. animation duration times not matching. there other way around. everyone's appreciated.
try , synchronize calls both functions @ place of calls. make sure there no heavy code in between calls add delays. might you.
Comments
Post a Comment