Comments (11)
可以先dismiss收起抽屉然后再进行push操作。。类似这样
- (void)cw_pushViewController:(UIViewController *)viewController{
UIViewController *rootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
UINavigationController *nav;
if ([rootVC isKindOfClass:[UITabBarController class]]) {
UITabBarController *tabbar = (UITabBarController *)rootVC;
NSInteger index = tabbar.selectedIndex;
nav = tabbar.childViewControllers[index];
}else if ([rootVC isKindOfClass:[UINavigationController class]]) {
nav = (UINavigationController *)rootVC;
}else if ([rootVC isKindOfClass:[UIViewController class]]) {
NSLog(@"This no UINavigationController...");
return;
}
[self dismissViewControllerAnimated:YES completion:nil];
[nav pushViewController:viewController animated:YES];
}
from cwlateralslide.
你好,我用了你下面的这个方法,问题解决了,但是push之后上面盖了一个maskview
from cwlateralslide.
每次都会这样吗?我的demo和自己项目都没出现过这种情况哦,方便提供一个出现这种情况的测试demo看看吗?还有你这个是1.5.0以上的版本吗?因为我这没法复现所以不能定位到问题。还有留着的这个MaskVIew使用之前的方法会出现吗。 如果你比较急 提供一种你自己修改的方式给你,你可以在收起抽屉之后 调用 [MaskView releaseInstance];这个方法,这个方法在#import "CWDrawerTransition.h"这个头文件下面,就是移除MaskView的。。可以把这个代码加到上面那个方法里面
- (void)cw_pushViewController:(UIViewController *)viewController{
UIViewController *rootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
UINavigationController *nav;
if ([rootVC isKindOfClass:[UITabBarController class]]) {
UITabBarController *tabbar = (UITabBarController *)rootVC;
NSInteger index = tabbar.selectedIndex;
nav = tabbar.childViewControllers[index];
}else if ([rootVC isKindOfClass:[UINavigationController class]]) {
nav = (UINavigationController *)rootVC;
}else if ([rootVC isKindOfClass:[UIViewController class]]) {
NSLog(@"This no UINavigationController...");
return;
}
[self dismissViewControllerAnimated:YES completion:^{
[MaskView releaseInstance];
}];
[nav pushViewController:viewController animated:YES];
}
这样应该能解决你的问题,但是仅仅只是打个补丁,并不能确定很好的解决了这种情况,如果能提供一下复现的demo是最好的,因为能从根本上找到出现这种问题的情况并解决它。
from cwlateralslide.
from cwlateralslide.
是的,用您最新的[MaskView releaseInstance]是可以解决,您能把您的邮箱发给我,我把demo发给您您看一下,产生这个问题的根本原因是什么
from cwlateralslide.
[email protected] 哈哈,别用“您”这种见外的称呼。。互相帮助而已啦😁
from cwlateralslide.
已经发给你啦😁😆
from cwlateralslide.
嗯嗯 我看到原因了,因为你dismiss的时候动画效果设置为false导致的。因为这个库是重定义了present与dismiss的转场动画做的,dismiss时的动画效果只能设置为true,不然不会走我写的方法。。所以就导致了MaskView不移除。。我看你代码里面的需求是不是不需要抽屉收起来的这个动画效果,就是抽屉没有动画的情况下直接消失,然后再push下一个界面,我在你那个方法稍微改了一下:
@objc func ClickAction(sender:UIButton){
let rootVC = UIApplication.shared.keyWindow?.rootViewController
// 添加了这两行
let animator : CWLateralSlideAnimator = self.transitioningDelegate as! CWLateralSlideAnimator;
// 这个为隐藏抽屉的动画时间,不需要隐藏抽屉动画效果可以把时间缩短到几乎没有,但是animated必须为true
animator.configuration.hiddenAnimDuration = 0.01;
//若这里用true,则后台退出时会回到中间控制器
self.dismiss(animated: true, completion: nil)
if sender.tag == 103 {
let vc = DevelopViewController()
(rootVC as! MianNavigationController).pushViewController(vc, animated: true)
}else if(sender.tag == 101){
let vc = HistoryViewController()
(rootVC as! MianNavigationController).pushViewController(vc, animated: true)
}
}
这样会比较好,后面我会考虑在push的方法里加上这个动画时间参数以满足更多不同的需求。
from cwlateralslide.
还有注册手势这个里加一个方向的判断,不然左右滑动手势都会显示抽屉😁
self.cw_registerShowIntractive(withEdgeGesture: false) { (direction) in
if (direction == CWDrawerTransitionDirection.left) {
self.MenuAction()
}
}
from cwlateralslide.
嘿嘿,好的哦,期待你后面在Push的方法里加一个时间属性😆
from cwlateralslide.
接口提供上去了。。1.5.5版本
from cwlateralslide.
Related Issues (20)
- iOS13,调用抽屉效果后返回,无论哪一层都会回到首页。 HOT 3
- 抽屉页面下隐藏tabbar无效? HOT 1
- 隐藏navigationbar导致侧滑白屏
- dismiss异常问题,设置rootViewController的ModalTransitionStyle可以解决 HOT 2
- CWLateralSlide和RTRootNavigationController结合使用的问题 HOT 3
- cw_pushViewController 不能显示下一个控制器导航栏 HOT 3
- 设置maskAlpha为0不管用 HOT 2
- 在三级控制器调用系统摄像头dismiss后回首页黑屏
- [self dismissViewControllerAnimated:YES completion:nil]; iOS13返回白屏
- 抽屉式做筛选功能的,dismiss之后页面没有之前的状态了 HOT 3
- 多个控制器都有侧滑窗口的时候cw_push会有问题
- 横竖屏问题
- 模态出来的vc,打开侧滑抽屉时,vc会上移至顶部
- 强制实现push到下一个controller返回后能保持抽屉打开状态以后产生的问题
- Unbalanced calls to begin/end appearance transitions for < mainViewController: 0x12f510530>
- 请问为什么 dissmiss 的时候 会闪烁一下呢?
- 返回白屏
- cw_pushViewController到一个控制器直接白屏
- 关于蒙版的优化 HOT 1
- 苹果新政策要求添加隐私清单PrivacyManifest,麻烦支持一下 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cwlateralslide.