[英]How to nest multiple CA animations?
如何嵌套多個 CA animation 像 UIView animateWithDuration 一樣? 例如,我需要制作 6 個動畫,其中每個下一個 animation 都在前一個之后。 因此,使用 UIView animateWithDuration,每隔一個 animation 從完整塊調用。 CA 是否允許使用塊等? 如果沒有,那么如何執行嵌套的順序動畫?
CAAnimation
沒有基於塊的 API,但您可以使用其委托方法animationDidStop:finished:
鏈接多個動畫。
如果您經常這樣做,您可能希望為此編寫自己的基於塊的包裝器。
替代 omz 的答案,您可以設置 NSTimer 對象來啟動 animation 的連續部分。
[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(legOne:) userInfo:nil repeats:NO];
[NSTimer scheduledTimerWithTimeInterval:4.0 target:self selector:@selector(legTwo:) userInfo:nil repeats:NO];
其中legOne:是執行animation等第一部分的方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.