本文介绍了从底部移动的UIView顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何移动视图从底部到顶部我的code:

How can I move a view from bottom to top on my code:

colorView.hidden=NO;
colorView=[[UIView alloc]init];
colorView.frame=CGRectMake(0,480,320, 480);
colorView.bounds=CGRectMake(0,200,320, 280);
colorView.backgroundColor=[UIColor greenColor];
colorView.alpha=1.0f;
[webView addSubview:colorView];
[self.view addSubview:webView];
[self createTransparentView];

所以,我怎么可以在这里添加动画?

So how can I add the animation here?

推荐答案

初始添加视图

self.postStatusView.frame = CGRectMake(0, 490, 320, 460);

有关从底部动画顶部添加以下

For animation from bottom to top add below

[UIView animateWithDuration:0.5
                      delay:0.1
                    options: UIViewAnimationCurveEaseIn
                 animations:^{
                     self.postStatusView.frame = CGRectMake(0, 0, 320, 460);
                 } 
                 completion:^(BOOL finished){
                 }];
[self.view addSubview:self.postStatusView];

除去视图

[UIView animateWithDuration:1.5
                              delay:0.5
                            options: UIViewAnimationCurveEaseIn
                         animations:^{
    self.postStatusView.frame = CGRectMake(0, 490, 320, 460);
                         }
                         completion:^(BOOL finished){
                             if (finished)
                                 [self.postStatusView removeFromSuperview];
                         }];

这篇关于从底部移动的UIView顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 01:53