我想要抽屉动画。因此,我采用1个UIView并在UIView中添加4个控件。现在,当我单击抽屉按钮时,在抽屉关闭时将视图高度设置为零,在抽屉打开时将视图高度设置为200。
但是当我将高度设置为零时,按钮不会隐藏。所有按钮都是可见的。自动布局不在我的项目中。
如何解决这个问题。
-(IBAction)Onclick_drawer:(id)sender
{
if(is_open)
{
is_open=false;
[UIView animateWithDuration:0.3
delay:0.0
usingSpringWithDamping:1.0
initialSpringVelocity:4.0
options: UIViewAnimationOptionCurveEaseInOut
animations:^{
self.drawer_view.frame=CGRectMake(0, 64, 320,200);
}
completion:^(BOOL finished){
}];
[UIView commitAnimations];
}
else
{
is_open=true;
[UIView animateWithDuration:0.3
delay:0.0
usingSpringWithDamping:1.0
initialSpringVelocity:4.0
options: UIViewAnimationOptionCurveEaseInOut
animations:^{
self.drawer_view.frame=CGRectMake(0, 64, 320, 0);
}
completion:^(BOOL finished){
}];
[UIView commitAnimations];
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句