1.动画弹出效果:红色区域块弹出时有动画效果,灰色蒙版弹出时不需要动画
- (void)show {
UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
[window addSubview:self];
[UIView animateWithDuration:0.25
delay:0
options:UIViewAnimationOptionCurveEaseOut
animations:^{
CGRect frame = self.popupView.frame;
frame.origin.y = frame.origin.y - frame.size.height;
self.popupView.frame = frame;
} completion:^(BOOL finished) {
}];
}
- (void)dismiss {
[UIView animateWithDuration:0.15
delay:0
options:UIViewAnimationOptionCurveEaseIn
animations:^{
CGRectframe =self.popupView.frame;
frame.origin.y= frame.origin.y+ frame.size.height;
self.popupView.frame= frame;
self.alpha=0;
}completion:^(BOOLfinished) {
[self removeFromSuperview];
}];