美文网首页
弹出动画

弹出动画

作者: 下页天 | 来源:发表于2016-10-12 12:46 被阅读22次
    //弹出蒙版及动画
    
    - (void)selectedCategory:(UIButton *)btn
    {
        btn.selected = !btn.selected;
        if (btn.selected) {
    
            [self.tableView addSubview:self.blurView];
            //设置blurView的约束
            [self.blurView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(self.tableView);
    
                make.top.equalTo(self.view.mas_top);
    
                make.size.mas_equalTo(CGSizeMake(MY_WIHTE, MY_HEIGHT-49-64));
            }];
            // 设置transform
            self.blurView.transform = CGAffineTransformMakeTranslation(0, -MY_HEIGHT);
            
        }
        
        
        [UIView animateWithDuration:0.5 animations:^{
          if (btn.selected) {
                //旋转
                btn.transform = CGAffineTransformMakeRotation((CGFloat)M_PI_2);
                //复原
                self.blurView.transform = CGAffineTransformIdentity;
    
                self.tableView.scrollEnabled = NO;
          }else
          {
              //复原
              btn.transform = CGAffineTransformIdentity;
              self.blurView.transform = CGAffineTransformMakeTranslation(0, -MY_HEIGHT);
              self.tableView.scrollEnabled = YES;
          }
            
        } completion:^(BOOL finished) {
            if (!btn.selected) {
                [self.blurView removeFromSuperview];
            }
        }];
    }
    

    相关文章

      网友评论

          本文标题:弹出动画

          本文链接:https://www.haomeiwen.com/subject/kwriyttx.html