我有一个动画,当按下按钮时,应该跳起来,然后向下漂浮.我用动画一个让它浮起来,第二个让它降下来.无论我做什么,第一个动画都没有浮动,它只是传送到顶部,第二个动画完全应该是它应该的.
这就是我所拥有的:
//This animation does not respond to its duration.
[UIView animateWithDuration:.5 delay:0.0
options:UIViewAnimationOptionCurveEaseOut
animations:^{
CGRect f = imageView.frame;
f.origin.y -= 40;
imView.frame = f;
}
completion:nil];
[UIView animateWithDuration:.7 delay:0.0
options:UIViewAnimationOptionCurveEaseOut
animations:^{
CGRect f = imageView.frame;
f.origin.y += 40;
imView.frame = f;
}
completion:nil];
Run Code Online (Sandbox Code Playgroud)
另一个问题我有它想要通过动画改变图像,但它总是从我最后声明的图像开始.谢谢!
我想IBAction在调用时使图像"流畅地"移动一定量的像素.我现在有一个让图像向左移动10个像素,但它只是传送到那里.我希望图像能够移动,就像它的行走并没有神奇地在那里结束一样.
这就是我所拥有的:
- (IBAction)moveImageLeft:(id)sender
{
y = y + 10;
myImageView.frame = CGRectMake(x, y, 45, 56);
}
Run Code Online (Sandbox Code Playgroud)