0
下面是我用來採取UIImageView
並使其上下浮動的代碼。創建動畫以使UIImageView無限上下(幾乎浮動)時,如何在動畫結束時停止暫停?
[UIView animateKeyframesWithDuration:2.0 delay:0.0 options:UIViewKeyframeAnimationOptionRepeat animations:^{
[UIView addKeyframeWithRelativeStartTime:0.0 relativeDuration:0.25 animations:^{
self.slider.transform = CGAffineTransformMakeTranslation(0, -5.0);
}];
[UIView addKeyframeWithRelativeStartTime:0.25 relativeDuration:0.5 animations:^{
self.slider.transform = CGAffineTransformMakeTranslation(0, 5.0);
}];
[UIView addKeyframeWithRelativeStartTime:0.75 relativeDuration:0.25 animations:^{
self.slider.transform = CGAffineTransformMakeTranslation(0, 0.0);
}];
} completion:^(BOOL finished) {
}];
但是,在動畫結束之後以及重新啓動之前,這個延遲會出現。
如何讓它變得流暢?
這就是我所要做的。無限地上下浮動。 –