2015-10-02 33 views

回答

0

這裏是值得信賴的文章:https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/Animation_Types_Timing/Articles/Timing.html 您將不得不處理CAAnimation,而不僅僅是UIView

更新: 由於PO沒能成功,到目前爲止,有什麼可以去錯了一些捕撈: 一)確保你的動畫被創建並添加類似如下:

CABasicAnimation* fadeAnim = [CABasicAnimation animationWithKeyPath:@"opacity"]; 
fadeAnim.fromValue = [NSNumber numberWithFloat:1.0]; 
fadeAnim.toValue = [NSNumber numberWithFloat:0.0]; 
fadeAnim.duration = 1.0; 
[theLayer addAnimation:fadeAnim forKey:@"opacity"]; 

// Change the actual data value in the layer to the final value. 
theLayer.opacity = 0.0; 

有關詳細信息,請參閱:https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreAnimation_guide/CreatingBasicAnimations/CreatingBasicAnimations.html

b)如果您使用animateTransition:確保

所有動畫都必須在transitionContext的 containerView屬性指定的視圖中進行。

(訪問https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewControllerAnimatedTransitioning_Protocol/#//apple_ref/occ/intfm/UIViewControllerAnimatedTransitioning/animateTransition:供參考)。希望這會幫助你將所有問題分類。

+0

是的,我也得出了這個結論。但是,我將我的CABasicAnimations添加到animateTransition中的圖層中,並且它沒有運行它們! – bandejapaisa

+0

請參閱我的答案更新 - 我描述了您的問題的一些可能的原因。 –

+0

謝謝。 b點看起來像一個有趣的筆記。我會進一步研究。 – bandejapaisa