美文网首页
iOS 动画弹出效果animateWithDuration

iOS 动画弹出效果animateWithDuration

作者: VickyLanLan | 来源:发表于2021-11-24 11:32 被阅读0次

1.动画弹出效果:红色区域块弹出时有动画效果,灰色蒙版弹出时不需要动画

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];

    }];

相关文章

网友评论

      本文标题:iOS 动画弹出效果animateWithDuration

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