【问题标题】:How can I make slide down transition animation?如何制作滑下过渡动画?
【发布时间】:2012-03-15 07:55:35
【问题描述】:

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

感谢大家的帮助

【问题讨论】:

标签: iphone objective-c


【解决方案1】:

尝试解决这个问题... 添加 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];

【讨论】:

    【解决方案2】:
    [[self navigationController] presentModalViewController:modalViewController animated:YES];
    

    并像这样隐藏它:

    [self.navigationController dismissModalViewControllerAnimated:YES];
    

    【讨论】:

    【解决方案3】:

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

    基本上,要淡入对象,您可以这样做:

    [[objectName animator] setOpacity: 1];
    

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

    【讨论】:

      【解决方案4】:

      您将视图框架设置为屏幕外的起始位置,然后通过一些动画将您的框架放置到位。

      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];
      

      【讨论】:

        猜你喜欢
        • 2015-05-07
        • 1970-01-01
        • 1970-01-01
        • 2021-09-03
        • 1970-01-01
        • 2020-10-08
        • 2018-05-16
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多