0

I'm animating an image to move up 50px, but as it moves, it leaves a shadow. How do I remove this shadow? I'd like the image to move smoothly. The shadow is only really present at the beginning of the animation.

Method used:

- (void)moveImage:(UIImageView *)image duration:(NSTimeInterval)duration
            curve:(int)curve x:(CGFloat)x y:(CGFloat)y
{
    // Setup the animation
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:duration];
    [UIView setAnimationCurve:curve];
    [UIView setAnimationBeginsFromCurrentState:YES];

    // The transform matrix
    CGAffineTransform transform = CGAffineTransformMakeTranslation(x, y);
    image.transform = transform;

    // Commit the changes
    [UIView commitAnimations];  
}

Calling the method:

[self moveImage:imageToMove duration:1.0
              curve:UIViewAnimationCurveLinear x:0.0 y:-70.0];

Image: enter image description here

kerbelda
  • 325
  • 1
  • 4
  • 14
  • Your code doesn't seem to make any shadows.. But I don't see you doing the `[self.view addSubView:image];` ? – Ty Lertwichaiworawit Aug 26 '14 at 17:51
  • Oh that's in the viewDidLoad method: `UIImageView *imageToMove =[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"landingpagelogo.png"]]; imageToMove.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); [self.view addSubview:imageToMove];` – kerbelda Aug 26 '14 at 21:49
  • I tried your code. There is no shadow. Maybe your image has a very high resolution? try the code with a low resolution image – Ty Lertwichaiworawit Aug 26 '14 at 21:54

0 Answers0