I have implemented a slider bar type UI control, like the Unlock mechanism on the iPhone.
When the touchesEnded method gets called, I return the slider to it's starting position. Instead, I would like to animate its move back to it's starting position.
The code should be something like this, but it doesn't work. What am I doing wrong here?
Self.unlock is a UIImageView:
CABasicAnimation *theAnimation;
theAnimation = [CABasicAnimation animationWithKeyPath:@"position.x"];
theAnimation.fromValue = [NSNumber numberWithFloat:BEGINX];
theAnimation.toValue = [NSNumber numberWithFloat: 0.0];
theAnimation.duration = 0.5;
[self.unlock addAnimation: theAnimation];
Sorry for the bone-headed question!