Skip to content
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

侧滑一半导行栏变白问题 #96

Open
lsb332 opened this issue Dec 21, 2017 · 2 comments
Open

侧滑一半导行栏变白问题 #96

lsb332 opened this issue Dec 21, 2017 · 2 comments

Comments

@lsb332
Copy link

lsb332 commented Dec 21, 2017

id _previousVisibleViewController = [objc_getAssociatedObject(self, _cmd) weakObjectValue];
if (!_previousVisibleViewController) {
    _previousVisibleViewController = [self.topViewController.transitionCoordinator viewControllerForKey:UITransitionContextFromViewControllerKey];  

// 测试这个问题出现在这部 如果滑动到一半返回 topViewController. transitionCoordinator 为nil 此时应该把_previousVisibleViewController 指向topViewController 因为后面用到这个_previousVisibleViewController 而这个controller为nil的时候就会出现空白了
if (!_previousVisibleViewController) {
_previousVisibleViewController = self.topViewController;
}
self.jz_previousVisibleViewController = _previousVisibleViewController;
}
return _previousVisibleViewController;

@suancaiyu
Copy link

不改变源码的情况下,只要在viewWillAppear方法里加上self.navigationController.jz_previousVisibleViewController;这一句调用就不会出现侧滑取消时的颜色问题。

但是返回到前一个页面时,前一个页面的导航栏颜色会相同。如果两个页面导航栏颜色不一样,前一个页面viewDidLoad时一定要加上jz_navigationBarTintColor的设置。

@Free-am
Copy link

Free-am commented May 16, 2018

@lsb332 正解

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