Search code examples
iosxcodeanimationuiimageviewsliding

Sliding Image in Xcode


In my app I have a button. I would like to be able to tap that button and then have it move to a point on the screen. However, I would also like the image to slide to the point rather than just appearing there. Any way I could do this? At this point, my image goes where I need it to go, I just want it to slide there. Any help is much appreciated. Thanks!


Solution

  • [UIView animateWithDuration:2.0 animations:^{
        imageView.center = CGPointMake(50, 50); // or wherever
    }];