I have a UIImageView that I'm trying to animate, but the animation puts it in the wrong location.
As a test I got the frame of the image:
then tried setting the frame to 27 in both of the following ways:
In each case the UIImageView is set exactly where I's expect it.
However, when I try to animate it, is uses a different location (above where it should be), even though I'm still using a y value of 27
I have to same to and from values in that animation simply as a test.
Any ideas why it's placing the image in the wrong location?
Thanks!
As a test I got the frame of the image:
Code:
CGRect frame = bucketView.characterImageView.frame;
frame.origin.y = 27;
then tried setting the frame to 27 in both of the following ways:
Code:
bucketView.characterImageView.frame = frame;
[bucketView.characterImageView layer].frame = frame;
In each case the UIImageView is set exactly where I's expect it.
However, when I try to animate it, is uses a different location (above where it should be), even though I'm still using a y value of 27
Code:
CABasicAnimation *positionAnimation;
positionAnimation = [CABasicAnimation animationWithKeyPath:@"position.y"];
positionAnimation.fromValue = [NSNumber numberWithFloat:27.0f];
positionAnimation.toValue = [NSNumber numberWithFloat:27.0f];
positionAnimation.duration = 1;
anim = [CAAnimationGroup animation];
anim.animations = [NSArray arrayWithObjects: positionAnimation, nil];
anim.duration = 1;
[[bucketView.characterImageView layer] addAnimation:anim forKey:@"position.y"];
I have to same to and from values in that animation simply as a test.
Any ideas why it's placing the image in the wrong location?
Thanks!