// 展开动画 - (void)beginAnimations { CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:nil context:context]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.6];//动画时间长度,单位秒,浮点数 myView.frame = CGRectMake(0, 0, 320, 110); [UIView commitAnimations]; } // 收起动画 - (void)endAnimations { CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:nil context:context]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.6];//动画时间长度,单位秒,浮点数 myView.frame = CGRectMake(0, -110, 320, 110); [UIView commitAnimations]; }