簡體   English   中英

動畫 UIImageView 的 CHANGE 僅一張圖像

[英]Animate the CHANGE of UIImageView only one image

我有一個 UIImageView,我想用 animation 更改它的圖像。 我檢查了如何使用數組為 UIImageView 設置動畫,但我不想使用很多圖像。

我只想使用任何類型的 animation 將當前圖像更改為新圖像一次。

只需輸入以下代碼:

#import <QuartzCore/QuartzCore.h>
...
imageView.image = [UIImage imageNamed:"The image name"];

CATransition *transition = [CATransition animation];
transition.duration = 1.0f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionFade;

[imageView.layer addAnimation:transition forKey:nil];

我想你正在搜索這個......

animationImages屬性同樣適用於其中的一個或多個圖像。

我想你可以找到你的答案

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM