Animate UIImage in UIImageView Up & Down (Like it's hovering) Loop

前端 未结 4 1387
情深已故
情深已故 2021-02-04 13:45

Hello I have an image that I\'d like to move up and down (Up 10 pixels and down 10 pixels) so that my image appears to be hovering. How can I do this with simple animation thank

4条回答
  •  悲哀的现实
    2021-02-04 14:19

    Try this:

    CGRect frm_up = imageView.frame;
    frm_up.origin.y -= 10;
    
    [UIView animateWithDuration:0.5
        delay:0.0
        options:UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeats
        animations:^{
            imageView.frame = frm_up;
        }
        completion:NULL
    ];
    

提交回复
热议问题