GithubHelp home page GithubHelp logo

当前一个VC设置setNavigationBarHidden为YES的时候,第二次进入webVC的时候,返回有BUG about rxwebviewcontroller HOT 12 OPEN

Regansun avatar Regansun commented on July 22, 2024
当前一个VC设置setNavigationBarHidden为YES的时候,第二次进入webVC的时候,返回有BUG

from rxwebviewcontroller.

Comments (12)

Roxasora avatar Roxasora commented on July 22, 2024

我复现一下~稍等

from rxwebviewcontroller.

Regansun avatar Regansun commented on July 22, 2024

问题解决了
//! 如果应该pop,说明是在 popViewController 之后,应该直接 popItems
if (self.shouldPopItemAfterPopViewController) {
self.shouldPopItemAfterPopViewController = NO;
[self popViewControllerAnimated:YES]; //////加上这句就ok了!
return YES;
}

from rxwebviewcontroller.

Roxasora avatar Roxasora commented on July 22, 2024

亲,可否把你的demo发给我看一下,这个地方这样设置可能会引起其他的问题。。

from rxwebviewcontroller.

Regansun avatar Regansun commented on July 22, 2024

我是在你的domo上直接改的,运行了下, 貌似别的地方也没影响

from rxwebviewcontroller.

Regansun avatar Regansun commented on July 22, 2024

好像是有问题,网页进入多级再返回就不对了

from rxwebviewcontroller.

Regansun avatar Regansun commented on July 22, 2024

-(BOOL)navigationBar:(UINavigationBar )navigationBar shouldPopItem:(UINavigationItem *)item{
//! 如果不应该 pop,说明是点击了导航栏的返回,这时候则要做出判断区分是不是在 webview 中
if ([self.topViewController isKindOfClass:[RxWebViewController class]]) {
RxWebViewController
webVC = (RxWebViewController*)self.viewControllers.lastObject;
if (webVC.webView.canGoBack) {
[webVC.webView goBack];
//!make sure the back indicator view alpha back to 1
self.shouldPopItemAfterPopViewController = NO;
[[self.navigationBar subviews] lastObject].alpha = 1;
return NO;
}else{
[self popViewControllerAnimated:YES];
return NO;
}
}if (self.shouldPopItemAfterPopViewController) {
//! 如果应该pop,说明是在 popViewController 之后,应该直接 popItems
self.shouldPopItemAfterPopViewController = NO;
return YES;
}else{
[self popViewControllerAnimated:YES];
return NO;
}
}
这样判断的顺序换下,应该可以了/有可能还有问题

from rxwebviewcontroller.

Roxasora avatar Roxasora commented on July 22, 2024

webviewController 的naviBar 是你自己设置的是吗? 我看你一开始隐藏了naviBar

from rxwebviewcontroller.

Regansun avatar Regansun commented on July 22, 2024

是用系统的,在第一个页面设置隐藏了,然后push以后的页面都不隐藏的

from rxwebviewcontroller.

Regansun avatar Regansun commented on July 22, 2024

好的,已经发你邮箱了

from rxwebviewcontroller.

Regansun avatar Regansun commented on July 22, 2024

之前修改的还是有问题,http://www.jianshu.com/p/6376149a2c4c 参考这个连接的貌似找到了完美解决的办法了

from rxwebviewcontroller.

ynot16 avatar ynot16 commented on July 22, 2024

这个问题有解决方案了么?复现的步骤就像题目说的一样,前一个vc隐藏了导航栏,然后push到另一个没有隐藏导航栏的vc。第一次push,pop是正常的,但是第二次push之后,就pop不了。必现。

from rxwebviewcontroller.

ynot16 avatar ynot16 commented on July 22, 2024

因为是隐藏导航栏出现的问题,我猜是self.shouldPopItemAfterPopViewController的记录出的问题。加了一下代码,貌似解决了
`- (void)setNavigationBarHidden:(BOOL)hidden animated:(BOOL)animated {
self.shouldPopItemAfterPopViewController = hidden;
[super setNavigationBarHidden:hidden animated:animated];
}

  • (void)setNavigationBarHidden:(BOOL)navigationBarHidden {
    self.shouldPopItemAfterPopViewController = navigationBarHidden;
    [super setNavigationBarHidden:navigationBarHidden];
    }`

from rxwebviewcontroller.

Related Issues (19)

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.