The following code animates the movement, even though I didn\'t use beginAnimations:context
. How do I get it to move without animating? This is a new iphone vi
The simplest way to do it is to override the animation duration by putting the position code into a transaction:
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[CATransaction begin];
[CATransaction setAnimationDuration:0];
sublayer.position = [[touches anyObject] locationInView:self.view];
[CATransaction commit];
}
More simplest way:
sublayer.position = [[touches anyObject] locationInView:self.view];
[sublayer removeAnimationForKey:@"position"];