-
Notifications
You must be signed in to change notification settings - Fork 378
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
rt_disableInteractivePop 被多次设置后无作用 #47
Comments
这个属性只在 self.extendedLayoutIncludesOpaqueBars;
self.automaticallyAdjustsScrollViewInsets;
self.edgesForExtendedLayout; 等属性一样 |
如果想要在某个ViewController的生命周期中,控制可划出/不可划出,还有其他方式实现吗? |
不能一开始就确定吗?如果用户手势返回滑到一半,突然又禁止呢? |
是这样子的,iOS8新增的WKWebview,可以通过右滑来返回上一页。 |
试试: self.rt_navigationController.interactivePopGestureRecognizer.enabled = !self.webView.canGoBack; 但是记得 vc 消失时还原设置 |
这个可以!非常感谢! |
可行,感谢🙏 |
使用手势依赖应该更科学点:#104 (comment) |
@KearLiao 不会每次都改,还有个条件 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我在demo的RTWebViewController界面中,添加了一个按钮,事件是每次点击,当前controller的rt_disableInteractivePop置非,
即:self.rt_disableInteractivePop = !self.rt_disableInteractivePop
在执行这个方法前能划出屏幕的情况下,执行之后,依旧能够划出屏幕(正常应该不能再划出了);
反之亦然;
真实的使用场景例如在 WKWebview 中,设置webview 的allowsBackForwardNavigationGestures 为yes,如果 webivew 的 canGoBack 的值是 YES,此时就不应该触发滑动退出页面的事件,而应该触发webview的goBack事件(类似微信的webview)
根据我的观察,存在以下几种情况
1.在viewDidLoad方法中设置 rt_disableInteractivePop 的值会生效;
2.WKWebview有缓存后,根据webview的状态(是否能goBack)在主线程重新设置rt_disableInteractivePop的值会生效;
The text was updated successfully, but these errors were encountered: