2012-10-23 58 views
2

任何想法爲什麼下面的代碼不能在IOS 6下工作,雖然它在執行NSLog的IOS 5下完全運行,但在IOS 6上(在模擬器和iPad中),NSLog根本不會執行!IOS 6 UIView動畫完成

[UIView animateWithDuration: 2.0f animations:^{ [self.view setAlpha:0.7f];} 
       completion:^(BOOL finished){ if(finished) NSLog(@"Finished !!!!!!");}]; 
+0

什麼不起作用?什麼都沒有發生或錯誤的事情?你在哪裏打電話? –

+0

Ir在IOS 5響應「完成」時完美運行,但在IOS 6上(在模擬器和iPad中)NSLog根本不執行! –

+0

今天我似乎遇到了一個非常類似的問題。我有一個可以在iOS 5上正常工作的動畫塊,但是在iOS 6上,完成塊永遠不會觸發。 – kcharwood

回答

8

這裏的代碼

[UIView animateWithDuration:2.0 
         delay:0.0 
        options: UIViewAnimationOptionCurveEaseInOut 
       animations:^{ 
        [self.view setAlpha:0.7f]; 

       } 
       completion:^(BOOL finished){ 
        if(finished) NSLog(@"Finished !!!!!"); 
        // do any stuff here if you want 
       }]; 
+0

需要UIViewAnimationOptionCurveEaseInOut,而不是UIViewAnimationCurveEaseInOut – coneybeare