UIView animation

前端 未结 5 2075
醉话见心
醉话见心 2020-12-30 18:00

I am trying to animate a UIView here. It looks like a rectangle, and I just want to translate it to my coordinations.

So, how can I animate it? I tried

5条回答
  •  醉话见心
    2020-12-30 18:48

    Here is an example of animating a view to move off screen. You should be able to slightly adjust it for your needs:

    
    [UIView beginAnimations:@"bucketsOff" context:nil];
    [UIView setAnimationDuration:0.4];
    [UIView setAnimationDelegate:self];
    //position off screen
    [bucketView setCenter:CGPointMake(-160, 377)];
    [UIView setAnimationDidStopSelector:@selector(finishAnimation:finished:context:)];
    //animate off screen
    [UIView commitAnimations];
    

提交回复
热议问题