Iphone 如何添加具有presentmodalview类型动画的子视图?

Iphone 如何添加具有presentmodalview类型动画的子视图?,iphone,ios,ipad,Iphone,Ios,Ipad,我有一份申请,我需要 将子视图添加到具有presentmodalview类型动画的视图中 [UIView animateWithDuration:0.25 delay:0 options: UIViewAnimationCurveEaseOut animations:^ { // set subView's frame } completion:^(BOOL finished) { } ]; 但是在 过渡 CATransition *animat

我有一份申请,我需要

将子视图添加到具有presentmodalview类型动画的视图中

[UIView animateWithDuration:0.25 delay:0 options: UIViewAnimationCurveEaseOut animations:^ {

        // set subView's frame

    } completion:^(BOOL finished) {

    }
     ];
但是在

过渡

CATransition *animation = [CATransition animation];
[animation setType:kCATransitionMoveIn];
[animation setSubtype:kCATransitionFromTop];
[animation setDuration:0.6f];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:
                              kCAMediaTimingFunctionEaseInEaseOut]];
[subview.layer addAnimation:animation forKey:@"someTransition"];
我没有发现任何类型的过渡。也在

翻译风格

有人能指导我吗?

试试这段代码

[self.view bringSubviewToFront:yoursubview];
CATransition *animation = [CATransition animation];
[animation setType:kCATransitionFade];
[animation setDuration:1.00];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:
                              kCAMediaTimingFunctionEaseIn]];
[yoursubview.layer addAnimation:animation forKey:@"fadeTransition"];
有关更多信息,请查看这些链接

  • 试试这个代码

    [self.view bringSubviewToFront:yoursubview];
    CATransition *animation = [CATransition animation];
    [animation setType:kCATransitionFade];
    [animation setDuration:1.00];
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:
                                  kCAMediaTimingFunctionEaseIn]];
    [yoursubview.layer addAnimation:animation forKey:@"fadeTransition"];
    
    有关更多信息,请查看这些链接


  • UIView
    动画中更改子视图的帧,如下所示

    最初设置

    subView.frame=CGRectMake(0,self.view.frame.size.height,your_width,your_height);
    
    然后在动画中设置所需的帧位置

    [UIView animateWithDuration:0.25 delay:0 options: UIViewAnimationCurveEaseOut animations:^ {
    
            // set subView's frame
    
        } completion:^(BOOL finished) {
    
        }
         ];
    

    UIView
    动画中更改子视图的帧,如下所示

    最初设置

    subView.frame=CGRectMake(0,self.view.frame.size.height,your_width,your_height);
    
    然后在动画中设置所需的帧位置

    [UIView animateWithDuration:0.25 delay:0 options: UIViewAnimationCurveEaseOut animations:^ {
    
            // set subView's frame
    
        } completion:^(BOOL finished) {
    
        }
         ];
    

    尝试使用
    UIView
    动画块:

    yourView.frame = CGRectMake(0, yourSuperView.frame.size.height, yourView.frame.size.width, yourView.frame.size.height);
    [yourSuperView addSubview:yourView];
    [UIView animateWithDuration:1.0 animations:^{
        yourView.frame = CGRectMake(0, 0, yourView.frame.size.width, yourView.frame.size.height);
    } completion:^(BOOL finished) {
        //Task to do on Animation completion.
    }];
    
    您可以根据自己的设置更改动画持续时间。您还可以使用以下命令:

    [UIView animateWithDuration:1.0 animations: {
          //your Implemntation
    }];
    


    请检查
    UIView动画选项
    部分中的动画选项和方法细节。

    尝试使用
    UIView
    动画块:

    yourView.frame = CGRectMake(0, yourSuperView.frame.size.height, yourView.frame.size.width, yourView.frame.size.height);
    [yourSuperView addSubview:yourView];
    [UIView animateWithDuration:1.0 animations:^{
        yourView.frame = CGRectMake(0, 0, yourView.frame.size.width, yourView.frame.size.height);
    } completion:^(BOOL finished) {
        //Task to do on Animation completion.
    }];
    
    您可以根据自己的设置更改动画持续时间。您还可以使用以下命令:

    [UIView animateWithDuration:1.0 animations: {
          //your Implemntation
    }];
    


    如果您只想使用CATTransition,请检查
    UIViewAnimationOptions
    部分中的动画选项以及方法的详细信息。

    CATransition *animation = [CATransition animation];
    [animation setType:kCATransitionMoveIn];
    [animation setSubtype:kCATransitionFromTop];
    [animation setDuration:0.6f];
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:
                                  kCAMediaTimingFunctionEaseInEaseOut]];
    [subview.layer addAnimation:animation forKey:@"someTransition"];
    

    如果您只想使用CATTransition

    CATransition *animation = [CATransition animation];
    [animation setType:kCATransitionMoveIn];
    [animation setSubtype:kCATransitionFromTop];
    [animation setDuration:0.6f];
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:
                                  kCAMediaTimingFunctionEaseInEaseOut]];
    [subview.layer addAnimation:animation forKey:@"someTransition"];
    

    你能告诉我如何用dismissmodalviewcontroller的相同动画删除这个吗?你能告诉我如何用dismissmodalviewcontroller的相同动画删除这个吗