Giter Site home page Giter Site logo

Comments (11)

ChavezChen avatar ChavezChen commented on July 20, 2024

可以先dismiss收起抽屉然后再进行push操作。。类似这样
111

- (void)cw_pushViewController:(UIViewController *)viewController{
    UIViewController *rootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
    UINavigationController *nav;
    if ([rootVC isKindOfClass:[UITabBarController class]]) {
        UITabBarController *tabbar = (UITabBarController *)rootVC;
        NSInteger index = tabbar.selectedIndex;
        nav = tabbar.childViewControllers[index];
    }else if ([rootVC isKindOfClass:[UINavigationController class]]) {
        nav = (UINavigationController *)rootVC;
    }else if ([rootVC isKindOfClass:[UIViewController class]]) {
        NSLog(@"This no UINavigationController...");
        return;
    }

    [self dismissViewControllerAnimated:YES completion:nil];
    [nav pushViewController:viewController animated:YES];
}

from cwlateralslide.

chenchao01 avatar chenchao01 commented on July 20, 2024

你好,我用了你下面的这个方法,问题解决了,但是push之后上面盖了一个maskview
be260de8-cda4-437d-b2b2-5c6874d0f41b

from cwlateralslide.

ChavezChen avatar ChavezChen commented on July 20, 2024

每次都会这样吗?我的demo和自己项目都没出现过这种情况哦,方便提供一个出现这种情况的测试demo看看吗?还有你这个是1.5.0以上的版本吗?因为我这没法复现所以不能定位到问题。还有留着的这个MaskVIew使用之前的方法会出现吗。 如果你比较急 提供一种你自己修改的方式给你,你可以在收起抽屉之后 调用 [MaskView releaseInstance];这个方法,这个方法在#import "CWDrawerTransition.h"这个头文件下面,就是移除MaskView的。。可以把这个代码加到上面那个方法里面

- (void)cw_pushViewController:(UIViewController *)viewController{
    UIViewController *rootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
    UINavigationController *nav;
    if ([rootVC isKindOfClass:[UITabBarController class]]) {
        UITabBarController *tabbar = (UITabBarController *)rootVC;
        NSInteger index = tabbar.selectedIndex;
        nav = tabbar.childViewControllers[index];
    }else if ([rootVC isKindOfClass:[UINavigationController class]]) {
        nav = (UINavigationController *)rootVC;
    }else if ([rootVC isKindOfClass:[UIViewController class]]) {
        NSLog(@"This no UINavigationController...");
        return;
    }

    [self dismissViewControllerAnimated:YES completion:^{
            [MaskView releaseInstance];
    }];
    [nav pushViewController:viewController animated:YES];
}

这样应该能解决你的问题,但是仅仅只是打个补丁,并不能确定很好的解决了这种情况,如果能提供一下复现的demo是最好的,因为能从根本上找到出现这种问题的情况并解决它。

from cwlateralslide.

chenchao01 avatar chenchao01 commented on July 20, 2024

from cwlateralslide.

chenchao01 avatar chenchao01 commented on July 20, 2024

是的,用您最新的[MaskView releaseInstance]是可以解决,您能把您的邮箱发给我,我把demo发给您您看一下,产生这个问题的根本原因是什么

from cwlateralslide.

ChavezChen avatar ChavezChen commented on July 20, 2024

[email protected] 哈哈,别用“您”这种见外的称呼。。互相帮助而已啦😁

from cwlateralslide.

chenchao01 avatar chenchao01 commented on July 20, 2024

已经发给你啦😁😆

from cwlateralslide.

ChavezChen avatar ChavezChen commented on July 20, 2024

嗯嗯 我看到原因了,因为你dismiss的时候动画效果设置为false导致的。因为这个库是重定义了present与dismiss的转场动画做的,dismiss时的动画效果只能设置为true,不然不会走我写的方法。。所以就导致了MaskView不移除。。我看你代码里面的需求是不是不需要抽屉收起来的这个动画效果,就是抽屉没有动画的情况下直接消失,然后再push下一个界面,我在你那个方法稍微改了一下:

    @objc func ClickAction(sender:UIButton){
        let rootVC = UIApplication.shared.keyWindow?.rootViewController
        // 添加了这两行
        let animator : CWLateralSlideAnimator = self.transitioningDelegate as! CWLateralSlideAnimator;
        // 这个为隐藏抽屉的动画时间,不需要隐藏抽屉动画效果可以把时间缩短到几乎没有,但是animated必须为true
        animator.configuration.hiddenAnimDuration = 0.01;
        //若这里用true,则后台退出时会回到中间控制器
        self.dismiss(animated: true, completion: nil)
        if sender.tag == 103 {
            let vc = DevelopViewController()
            (rootVC as! MianNavigationController).pushViewController(vc, animated: true)
        }else if(sender.tag == 101){
            let vc = HistoryViewController()
            (rootVC as! MianNavigationController).pushViewController(vc, animated: true)
        }
    }

这样会比较好,后面我会考虑在push的方法里加上这个动画时间参数以满足更多不同的需求。

from cwlateralslide.

ChavezChen avatar ChavezChen commented on July 20, 2024

还有注册手势这个里加一个方向的判断,不然左右滑动手势都会显示抽屉😁

self.cw_registerShowIntractive(withEdgeGesture: false) { (direction) in
    if (direction == CWDrawerTransitionDirection.left) {
        self.MenuAction()
    }
}

from cwlateralslide.

chenchao01 avatar chenchao01 commented on July 20, 2024

嘿嘿,好的哦,期待你后面在Push的方法里加一个时间属性😆

from cwlateralslide.

ChavezChen avatar ChavezChen commented on July 20, 2024

接口提供上去了。。1.5.5版本

from cwlateralslide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.