I’m trying to animate a Cocos2d node and a UIKit view move like this:
-(void)someFunction {
[myCocosNode runAction:[CCMoveTo actionWithDuration:myTime position:cocosPoint]];
[UIView animateWithDuration:myTime animations:^{ myView.frame = CGRectMake(uiPoint.x, uiPoint.y, myWidth, myHeight); }];
}
But the UIKit view doesn’t move at the same speed as the Cocos2d node, and they are in the same starting position going to the same ending position.
Any ideas?
Found a solution that works for synchronizing movement by PhilM in this thread.
He attaches the UIView to a subclass of CCLayer and overrides
setPosition:to update theUIView‘s position when the layer moves. Then usingCCMoveToon the layer will synchronize the movement with theUIView.Thanks PhilM!