答案 0 :(得分:1)
如果您希望自己的应用是iOS< 4兼容,使用此:
[UIView beginAnimations:@"animation" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveLinear]; //Different Animation Curves available, check docs.
[UIView setAnimationDuration:1.0]; //In seconds
//Here do your stuff
int newPosY = myImage.frame.origin.y - 10;
[myImage setFrame:CGRectMake(self.frame.origin.x, newPosY, myImage.frame.size.width, myImage.frame.size.height)];
[UIView commitAnimations];
此代码段会将图像向上移动10个像素。您可以在调用commitAnimations
同时检查UIView Reference扩展信息。