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

2023-12-11  本文已影响0人  苏格拉meiyou底

弹出  : 

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

    }];

上一篇 下一篇

猜你喜欢

热点阅读