2012-03-15 83 views
0

我可以看到很多過渡動畫:從左到右,從右到左,漸隱,但是我怎樣才能從上到下過渡?如何讓幻燈片放下過渡動畫?

感謝所有幫助

+0

http://stackoverflow.com/questions/6605959/implement-custom-animation-to-present-modal-view- from-specified-view-on-ipad – 2012-03-15 08:01:21

+0

http://stackoverflow.com/questions/7188584/complete-list-of-transitions-you-can-do-between-views-on-iphone-ipad/7328633#7328633 – chikuba 2012-03-15 08:12:03

回答

0
[[self navigationController] presentModalViewController:modalViewController animated:YES]; 

和隱藏像這樣:

[self.navigationController dismissModalViewControllerAnimated:YES]; 
+0

是的,我也使用類似的東西,但無法找到讓它從上到下移動的方式 – user1035877 2012-03-15 08:17:11

+0

看到這個鏈接.. http://stackoverflow.com/questions/237310 /何燦的i-變化的動畫風格對的一模態-的UIViewController – 2012-03-15 08:19:01

0

你可以使用的Core Animation,您使用的是什麼樣的對象呢?

基本上,你這樣做的目的是淡化:

[[objectName animator] setOpacity: 1]; 

記住,你首先需要在動畫開始之前,設置不透明度爲0等。 希望這是你想要的。

0

您將視圖框設置爲離開屏幕的起始位置,然後使用某些動畫將您的框架放置到位。

CGRect originalFrame = [detailsView frame]; 
CGRect offscreenFrame = originalFrame; 
offscreenFrame.origin.y -= offscreenFrame.size.height; 
detailsView.frame = offscreenFrame; //Send the frame above screen   

//Add view here if necessary to an unscrew view 
// [aSuperView addSubview:detailsView]; 

[UIView beginAnimations:@"BringIn" context:nil]; 
[UIView setAnimationDuration:.3]; 
[UIView setAnimationDelegate:self]; 
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn]; 
detailsView.frame = originalFrame 
[UIView commitAnimations]; 
2

嘗試修好這... 添加QuartzCore框架

#import <QuartzCore/QuartzCore.h> 

CATransition *transDown=[CATransition animation]; 
[transDown setDuration:0.5]; 
[transDown setType:kCATransitionPush]; 
[transDown setSubtype:kCATransitionFromBottom]; 
[transDown setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; 

[Boottom_view.layer addAnimation:transDown forKey:nil];