1.動畫彈出效果:紅色區(qū)域塊彈出時有動畫效果,灰色蒙版彈出時不需要動畫


view的y值一定要注意

- (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];
? ? }];