本文介绍了从下到上移动 UIView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在我的代码中从下到上移动视图:
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 the animation from bottom to top add below:
[UIView animateWithDuration:0.5
delay:0.1
options: UIViewAnimationOptionCurveEaseIn
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: UIViewAnimationOptionCurveEaseIn
animations:^{
self.postStatusView.frame = CGRectMake(0, 490, 320, 460);
}
completion:^(BOOL finished){
if (finished)
[self.postStatusView removeFromSuperview];
}];
这篇关于从下到上移动 UIView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!