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

addchildViewController的方式添加控制器,返回按钮的bug #25

Closed
Bretra opened this issue May 9, 2019 · 8 comments
Closed

Comments

@Bretra
Copy link

Bretra commented May 9, 2019

如题,通过addchildviewcontroller的方式来添加jx控制器,左边返回按钮却出现,应该是webivew是否可以canback的时候再出现,一级界面
image

@Bretra
Copy link
Author

Bretra commented May 9, 2019

  • (void)updateNavigationItems {
    if (self.webView.canGoBack) {
    self.navigationController.interactivePopGestureRecognizer.enabled = NO;
    if (self.showCloseNavLeftItem){
    [self.navigationItem setLeftBarButtonItems:@[self.backNavLeftItem, self.closeNavLeftItem] animated:NO];
    }else{
    [self.navigationItem setLeftBarButtonItems:@[self.backNavLeftItem] animated:NO];
    }
    } else {
    self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    [self.navigationItem setLeftBarButtonItems:@[] animated:NO];
    }
    }

修改成这样子了

@Bretra
Copy link
Author

Bretra commented May 9, 2019

self.backImagePath = @"";
设置这个未空无效,但是设置closeImagePath却可以

@xiubojin
Copy link
Owner

好的,感谢提出的两个问题,我会尽快修复好。

@xiubojin
Copy link
Owner

设置返回图片和关闭图片的代码是一样的,我这边试了没问题,你看看你那边是不是图片路径设置的有问题。

@Bretra
Copy link
Author

Bretra commented May 14, 2019

我这边设置图片的路径为nil,是不让他现实出来。为什么这样子设置,正是因为通过addchildviewcontroller的方法来添加JXBWebViewController,在父vc里面,返回按钮就出现了,这个问题比较重要,正是第一个图片现实的那样

@Bretra
Copy link
Author

Bretra commented May 14, 2019

显示返回按钮,和显示x按钮,你应该在JXBWebViewController里面进行判断下,我看了源码里面并没有进行判断关于vc的,只是进行了判断是否可以返回的这个事件

@Bretra
Copy link
Author

Bretra commented May 16, 2019

self.navigationController.interactivePopGestureRecognizer.enabled = YES;
[self.navigationItem setLeftBarButtonItems:@[self.backNavLeftItem] animated:NO];
if (self.presentingViewController) {
//modal进来的
NSLog(@"modal进来的");
}else {
//非modal进来
if ([self.navigationController.viewControllers containsObject:self]) {
//push进来的
NSLog(@"push进来的");
}else {
//addchildViewController方式进来的
NSLog(@"addchildViewController方式进来的");
[self.navigationItem setLeftBarButtonItems:nil animated:NO];
}
}

添加这段代码后 你那边测试下,我这边测试OK的

@xiubojin
Copy link
Owner

嗯,最新的代码已经改成这个了。

@Bretra Bretra closed this as completed May 17, 2019
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

2 participants