我正在使用swift在我的应用程序中做哇滑块动画效果。我添加了3张图片。它正在一张一张地滑动。但是我需要这样的动画。从一幅图像过渡到另一幅图像时,我不知道该怎么办。请指导我。动画效果如下。不仅此动画效果,而且任何动画效果。
<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS9RdUxjNC5wbmcifQ==” alt =“在此处输入图像描述”>
不完全相同,但是可以使用UIViewAnimations获得相似的动画效果。例如,尝试此:
[UIView transitionWithView:textFieldimageView
duration:0.5f
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
imageView.oldImage = newImage;
} completion:NULL];
尝试使用此语法进行快速查找:
Swift 2
UIView.transitionWithView(self.view, duration: 0.5, options: UIViewAnimationOptions.TransitionCrossDissolve, animations: {
}, completion: { (fininshed: Bool) -> () in
})
Swift 3,4,5
UIView.transition(with: self.view, duration: 0.5, options: UIView.AnimationOptions.transitionCrossDissolve, animations: {
}, completion: { (fininshed: Bool) -> () in
})