2013-03-18 66 views
0

在我的應用程序中,我想給一個圖像的翻轉動畫,當一個按鈕被點擊時。但是當我嘗試這樣做時,我只能對CGAffinetransformationMake做一個圖像的四種轉換(移動,縮放,旋轉,翻譯)。但我需要翻轉式的轉換。任何人都可以幫助我做到這一點?Custom CGAffineTransformationMake

+0

您可以使用UIViewAnimationOptionTransitionFlipFromLeft或UIViewAnimationOptionTransitionFlipFromRight動畫。 – Mrunal 2013-03-18 11:52:09

+0

@mrunal我認爲這個選項適用於segue transition.not對於圖像 – haritha 2013-03-18 11:54:56

+0

nope這是UIView動畫,你的UIImageView已經被UIView繼承,所以你可以使用它來進行圖像視圖。 – Mrunal 2013-03-18 11:56:09

回答

0

試試這個。它一定會有所幫助。在按鈕點擊功能中,您必須編寫此代碼。

[UIView beginAnimations: nil context: nil]; 
[UIView setAnimationDuration: 0.5f]; 
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:yourImageName cache: YES]; 
[UIView commitAnimations]; 
0

嘗試下面的一個希望它會幫助你一點點。

[UIView animateWithDuration:0.5 animations:^(void){ 
    _viewSlidecontainer.transform = CGAffineTransformMakeScale(1.0, 0.0); 
} completion:^(BOOL finished){ 
    [UIView animateWithDuration:0.5 animations:^(void){ 
     _viewSlidecontainer.transform = CGAffineTransformMakeScale(1.0, 1.0); 
    } completion:^(BOOL finished){ 

    }]; 
}];