0

我有一个 Objective C 项目,当用户第一次登录时,需要进行一些处理,可能需要大约 30 秒。在此期间,我正在显示一个进度条,并且我还想显示我从用户的在线个人资料(使用 SDWebImage)中获取的不同照片和文本(与每张照片相关)。

我正在尝试找到图像之间过渡效果的示例。我每 1 秒进行一次转换,我遇到的问题是图像刚刚出现(没有任何淡入效果或任何其他效果),并且有时图像尚未下载,因此存在某种丑陋的占位符。

任何建议或示例代码将不胜感激。

4

2 回答 2

0

As you’ve figured by experiment, UIImageView’s image property isn’t animatable.

CALayer’s contents property, however, is.

If all you want is a simple fade transition, you need not do more than assigning the CGImageRef that underlies your UIImage to the layer’s contents and you get a nice fade.

If you need more power, you might want to add a CATransitionas the animation for the nil key of your layer. Now, that will fire the next time you set the contents, unleashing the power of CoreImage filters at low implementation cost.

于 2012-11-09T09:53:43.010 回答
0

您可能需要使用两个 CIImage,以便您可以在两个 CIImage 之间应用转换过滤器 (CIFilter)。本文有一个使用这种方法的示例代码

于 2012-11-08T13:59:10.233 回答