HeathWang / HWPanModal

HWPanModal presents controller from bottom and drag to dismiss, high customize. iOS13 default modalPresentationStyle. 任意形式的底部弹框动画;头条、知乎、抖音弹出评论效果;地图浮层,iOS13 present默认模态效果。
MIT License
1.17k stars 199 forks source link

Dismiss 全部控制器问题 #117

Closed fuchenxi closed 2 years ago

fuchenxi commented 2 years ago
- (void)adt_dismissAllViewControllerAnimated:(BOOL)flag completion: (void (^ __nullable)(void))completion {

    UIViewController *vc = self;
    while (vc.presentingViewController) {
        vc = vc.presentingViewController;
    }
    [vc dismissViewControllerAnimated:flag completion:completion];
}

场景:全部通过 present方式 A -> B ->C -> D , 我通过获取到A控制器的方式 dismiss 所有presentingViewController,A/B/C的遮罩并没有进行动画,而是控制器消失时 瞬间移除的。能否全部通过动画的形势往下收回?

HeathWang commented 2 years ago

目前做不到,调用系统的dismiss方法就直接移除的。

HeathWang commented 2 years ago

我看下能不能把API暴露出来,可以主动通过动画往下消失。

HeathWang commented 2 years ago

HWPanModal (0.9.2) 增加了api:- (void)hw_dismissAnimated:(BOOL)animated completion:(void (^)(void))completion可以给每个vc单独dismiss