如何制作向下滑动过渡动画?

时间:2012-03-15 07:55:36

标签: iphone objective-c

我可以看到很多过渡动画:从左到右,从右到左,褪色,但我怎样才能从上到下进行过渡?

感谢您的帮助

4 个答案:

答案 0 :(得分: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];

答案 1 :(得分:0)

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

并将其隐藏起来:

[self.navigationController dismissModalViewControllerAnimated:YES];

答案 2 :(得分:0)

您可以使用Core Animation,您使用的是什么类型的对象?

基本上,要淡化对象,请执行以下操作:

[[objectName animator] setOpacity: 1];

请记住,首先需要在动画开始前将不透明度设置为0等。 希望这是你想要的。

答案 3 :(得分: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];