//弹出蒙版及动画
- (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];
}
}];
}
网友评论