Skip to content

手势返回后,再进入第二个页面的问题。 #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hengchengfei opened this issue Mar 16, 2015 · 6 comments
Closed

手势返回后,再进入第二个页面的问题。 #13

hengchengfei opened this issue Mar 16, 2015 · 6 comments

Comments

@hengchengfei
Copy link

若不加上下面这句时,会有一个明显的bug。
self.view.disableMLBlackTransition=YES;

比如:
ANavigation push到-> BController

但是BController的导航栏的标题是动态的。

此时左滑,但不back,再点击下一步时,会有问题。

@molon
Copy link
Owner

molon commented Mar 26, 2015

@hengchengfei 我不是太明白你的问题。 可否加我的Q姚姚启叁贰贰贰肆贰 我们细聊

@molon
Copy link
Owner

molon commented Jul 21, 2015

@hengchengfei

@molon molon closed this as completed Jul 21, 2015
@pomin
Copy link

pomin commented Dec 15, 2015

遇到一样的问题了,解决了么?
就用你自己的Demo,
//测试2套-------------------------------------------
//测试切换nav的隐藏后效果

先进入到隐藏了状态栏的VC,然后正常拖动返回,然后继续拖动返回,但是左滑到一半的时候,松手回到当前页面,这个时候导航栏就出错了。

@molon
Copy link
Owner

molon commented Dec 15, 2015

@pomin 请加我QQ , 因为我自己重现不了,需要帮忙一下。QQ在上面有

@molon molon reopened this Dec 15, 2015
@molon
Copy link
Owner

molon commented Mar 2, 2016

UIKit内部呢,在导航条隐藏显示的切换情景下似乎本身就有BUG,容易导致导航条错乱甚至异常消失的问题。即使不用此库也容易遇到。
这是我前段时间实现(左VC导航条隐藏,右VC导航条显示)的情景下发现的,而我的项目里并没有用到此库。
这里贴上这种情景下在下的最终解决办法,以下代码是放到左VC下,并且左VC是NavigationController的firstVC。如果是其他关于导航条的问题,可能需要更复杂的实现。

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];

    if (!self.navigationController.presentedViewController&&![self.navigationController.transitionCoordinator isCancelled]) {
        [self.navigationController setNavigationBarHidden:NO animated:animated];
    }
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];

    //MARK:偶尔在非常快速的从第二个页面取消拖返的时候,这里的输出会是 1 0 1 0。但是第二次的set hidden to no是有效的。
    //猜测可能是由于动画animated的原因,造成了第一次set hidden to no的还原。具体未知
    //所以我们在下一个runloop里去重新设置下应该就OK了
//    DLOG(@"1.hidden:%d",self.navigationController.navigationBarHidden);
    if (self.navigationController.navigationBarHidden) {
        [self.navigationController setNavigationBarHidden:NO animated:NO];
    }
//    DLOG(@"2.hidden:%d",self.navigationController.navigationBarHidden);
    dispatch_async(dispatch_get_main_queue(), ^{
//        DLOG(@"3.hidden:%d",self.navigationController.navigationBarHidden);
        if (self.navigationController.navigationBarHidden) {
            [self.navigationController setNavigationBarHidden:NO animated:NO];
        }
//        DLOG(@"4.hidden:%d",self.navigationController.navigationBarHidden);
    });
}

而在没有需要导航条隐藏切换的情景下,没有发现过什么问题。
虽然这类问题实际上感觉和此库没有什么关系,但此issue会一直保活,以后尽量更新解决方案。

而倘若导航条隐藏显示切换比较多的项目,或许可以考虑使用类似网易新闻那样的两份导航条重叠的方案。

@molon
Copy link
Owner

molon commented Dec 1, 2016

@hengchengfei @pomin
navigationBarHidden 设置为YES 的时候SDK有一些BUG,苹果一直没有解决。
可以尝试使用https://github.com/molon/MLNavigationBarTransition 来处理。

@molon molon closed this as completed Dec 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants