You should not do it this way. If you make your step value small enough for smooth movement it will be too slow.
You want to use UIView animation. Take a look at the the method animateWithDuration:animations:
(and it's variations)
Your code might look like this:
#define K_AMOUNT_TO_MOVE
-(void)moveImages
{
[UIView animateWithDuration: 2.0
animations: ^
{
for(int i=0;i<images.count;i++)
{
UIImageView *MyImage = images[i];
MyImage.center = CGPointMake (MyImage.center.x, MyImage.center.y- K_AMOUNT_TO_MOVE);
}
}
];
}
There are variations on that basic method that take options that will auto-reverse the animation, make it repeat, change the timing to linear instead of the default ease-in, ease-out, etc. Take a look at the method animateWithDuration:delay:options:animations:completion:
in the Xcode documentation.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…