類似SO質疑裁判:Why does UIView:animateWithDuration complete immediately?然而,我的代碼使用[UIView的beginAnimation]等ipad:爲什麼我的順序動畫的第一個動畫總是立即完成?
我基本上這樣的:
[UIView beginAnimation ...];
[UIView setAnimationDelay: 0.0];
[UIView setAnimationDuration: 1.25];
animatedImage.transform = "scale-up transform";
[UIView setAnimationDelay: 1.25]
[UIView setAnimationDuration: 0.50];
animatedImage.transform = "scale-down transform";
[UIView commitAnimation];
的圖像立即跳轉到擴大規模的大小,然後1.25秒後,它很好地適應「縮小」尺寸。如果我鏈接更多的序列,它們都可以正常工作,除了第一個。
這是否與嵌套的beginAnimations功能相同?因爲我嘗試過並且發生同樣的失敗。同時,我會嘗試您的建議並回復給您(感謝您的快速回復)。 – mobibob
如果您使用兩個獨立的beginAnimations,則第二個將停止第一個。在第二個延遲可能工作,從來沒有測試過,但我認爲使用beginAnimationsWithDuration更好,因爲你可以設置持續時間。完成也比延遲處理更穩定,另外還有另外一個版本的beginAnimations,它提供了更多參數,可以讓您在動畫中設置特殊選項。 – Aberrant
對不起,我不是這個意思。該文件說,你可以嵌套[UIView beginAnimation] [UIView beginAnimation [UIView commitAnimation] [UIView commitAnimation]。這相當於你的代碼嗎? – mobibob