效果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  在实践中动态操作

 

相关文章:

  • 2021-08-15
  • 2021-04-11
  • 2021-11-20
  • 2022-12-23
  • 2021-11-18
  • 2022-01-10
  • 2022-12-23
  • 2021-10-20
猜你喜欢
  • 2021-10-07
  • 2021-08-17
  • 2022-12-23
  • 2022-01-15
  • 2022-01-05
  • 2021-12-10
  • 2021-09-19
相关资源
相似解决方案