2010-08-26 187 views
2

任何人都可以幫助我添加動畫子視圖。我想添加像CATransition這樣的動畫的子視圖,但是通過這個類我們只有幾種不同的動畫類型。但我在尋找能力來實現它自己的動畫 - 在不同時間出現的不同視角。添加動畫子視圖

也許有存在的一些例子或者別的

+0

你是說你想要的東西不是CATransition動畫?你有你想要的樣品嗎? – Neeku 2012-06-27 13:01:53

回答

1

您有動畫

new_view.hidden=NO; 

    CATransition *transition=[CATransition animation]; 
    transition.type=kCATransitionPush; 
    transition.subtype=kCATransitionFromTop; 
    transition.duration=0.10; 
    [[new_view layer] addAnimation:transition forKey:@"animation2"]; 
1

實現了附加子視圖此代碼爲UIView的動畫:

[newView setFrame:CGRectMake(0.0f, 480.0f, 320.0f, 480.0f)]; //notice this is OFF screen! 
[UIView beginAnimations:@"animateTableView" context:nil]; 
[UIView setAnimationDuration:0.4]; 
[newView setFrame:CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)]; //notice this is ON screen! 
[UIView commitAnimations]; 

還有一些建在動畫中作爲翻轉和捲曲:

[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:1.0]; 
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight 
          forView:newView 
          cache:YES]; 

[self.navigationController.view addSubview:settingsView.view]; 
[UIView commitAnimations]; 

here更多: