Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

99miles

macrumors member
Original poster
Oct 10, 2008
50
0
How do I keep an object in the location it ends up in at the end of an animation?

The docs say that implicit animations should occur by default when you set a property, however I don't see that happening.

So I have an animation where I move a UIView down like this:

Code:
CABasicAnimation *moveDown;
moveDown			= [CABasicAnimation animationWithKeyPath:@"position.y"];
moveDown.toValue	= [NSNumber numberWithFloat:54];
moveDown.duration	= 0.5;
moveDown.removedOnCompletion = NO;
moveDown.fillMode	= kCAFillModeForwards;
[[bucketView.characterImageView layer] addAnimation:moveDown forKey:@"y"];

I want the object to remain in the location it's in at the end of the animation, that's why I set 'removedOnCompletion' and 'fillMode'. This works, but if I later try to change the frame of this view it doesn't do anything.

Code:
CGRect frame = bucketView.characterImageView.frame;
frame.origin.y = 50;
bucketView.characterImageView.frame = frame;

What's the simplest way to achieve this?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.