美文网首页
iOS 类似底部模态弹出动画效果

iOS 类似底部模态弹出动画效果

作者: 苏格拉meiyou底 | 来源:发表于2023-12-11 17:15 被阅读0次

弹出  : 

    UIWindow *window = [[[UIApplication sharedApplication] delegate] window];

    [windowaddSubview:self];

    [UIView animateWithDuration:0.25

                          delay:0 options:UIViewAnimationOptionCurveEaseOut

                     animations:^{

        CGRectframe =self.backView.frame;

        frame.origin.y= frame.origin.y- frame.size.height;

        self.backView.frame= frame;

    }completion:^(BOOLfinished) {

    }];

退出:

    [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{

        CGRectframe =self.backView.frame;

        frame.origin.y= frame.origin.y+ frame.size.height;

        self.backView.frame= frame;

        self.alpha=0;

    }completion:^(BOOLfinished) {

        [self removeFromSuperview];

    }];

相关文章

网友评论

      本文标题:iOS 类似底部模态弹出动画效果

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