效果1.点击按钮上浮
2.点击按钮下沉
3.点击按钮下拉展示
4.点击按钮向上收缩
5.左右如是说
关键是改变视图的大小位置的时机正确与否
eg1.1.点击按钮下沉消失
已知myView.frame=cgrectmake(0,phoneHeight,320,200);
[UIView animateWithDuration:0.8f animations:^{ myView.frame=CGRectMake(0,Phone_Height,320,0); } completion:^(BOOL finished) { [ myView removeFromSuperview]; }];
eg1.2点击按钮上浮展示
已知按钮 myView.frame=CGRectMake(0,Phone_Height,320,0);
[UIView animateWithDuration:0.8f animations:^{ myView.frame=CGRectMake(0,Phone_Height,320,200); [self.view addSubView:myView]; } completion:^(BOOL finished) { }];
eg1.3点击按钮下拉展示
已知 myView.frame=CGRectMake(0,0 , Phone_Weight, 0);
[UIView animateWithDuration:0.8f animations:^{ myView.frame=CGRectMake(0, moment_status+44, Phone_Weight,200); } completion:^(BOOL finished) { }];
eg1.3点击按钮向上收缩
已知 myView.frame=CGRectMake(0,moment_status+44, Phone_Weight, 200);
[UIView animateWithDuration:0.8f animations:^{ myView.frame=CGRectMake(0, moment_status+44, Phone_Weight,combox_height); } completion:^(BOOL finished) { myView.frame=CGRectMake(0, moment_status+44, Phone_Weight,0); }];
//以上是简单操作使用,可能还需要 addSubView操作或者 removeFromeSuperView 在实践中动态操作