2012-02-09 82 views
0

haii我有一個viewcontroller中的5個子視圖,每個子視圖都會在點擊相應的按鈕時顯示。但通常當我點擊按鈕時,它會顯示沒有動畫或轉義的子視圖。我需要給出彈出時子視圖的效果。 我想這,但沒有運氣iPhone中的子視圖的動畫sdk

[UIView beginAnimations:@"page transition" context:nil]; 
    [UIView setAnimationDuration:1.0]; 
    [UIView setAnimationTransition: UIViewAnimationTransitionCurlUp forView:NoteView cache:YES]; 

    [self.view addSubview:NoteView]; 

按鈕click.is有什麼辦法動畫這樣。

回答

0

你應該使用塊動畫,看

transitionFromView:toView:duration:options:completion: 
中的UIView

,與UIViewAnimationOptionTransitionCurlUp作爲選項面具

+0

你可以請xplain – stackiphone 2012-02-09 10:36:53

+0

而不是把動畫代碼放在開始和提交調用之內,你應該在塊中包含它,蘋果文檔給出一個很好的描述[這裏](https://developer.apple.com/library/ios/) #文檔/ WindowsViews /概念/ ViewPG_iPhoneOS/AnimatingViews/AnimatingViews.html#// apple_ref/DOC/UID/TP40009503-CH6-SW1) – wattson12 2012-02-09 10:57:52

0

你忘了添加commitAnimation方法

[UIView beginAnimations:@"page transition" context:nil]; 
[UIView setAnimationDuration:1.0]; 
[UIView setAnimationTransition: UIViewAnimationTransitionCurlUp forView:NoteView cache:YES]; 

[self.view addSubview:NoteView]; 
[UIView commitAnimation]; 
+0

我得到的一個一個errro,沒有找到commitanimation(返回類型默認爲id) – stackiphone 2012-02-09 10:17:36

+0

對不起,它應該是[UIView commitAnimations]; – rakeshNS 2012-02-09 10:39:54