Comments (7)
navigationController?.dismiss(动画:false)
let starVc = TDViewController()
starVc.hidesBottomBarWhenPushed = true
navigationController?.pushViewController(starVc,动画:true)
这样写可以解决问题,但觉得不是很对。
from sidemenu.
可以尝试下这样设置,然后在pushViewController后手动调用下dismiss
from sidemenu.
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at:indexPath,动画:true)
let starVc = TDViewController()
starVc.hidesBottomBarWhenPushed = true
navigationController?.pushViewController(starVc,动画:true)
}
当我从侧栏的页面中didseleted方法中push一个新页面,这样做会出现闪烁。类似有个黑色的遮罩遮住了页面零点几秒,在不同的页面之前push时发生概率大点。每次App重新运行后也可以复现,但当我推了几次页面后,这个问题就自己消失了。
+1
from sidemenu.
It works for me version 6.5.0
Add
extension UINavigationController { func pushViewController(_ viewController: UIViewController, animated: Bool = true, completion: (() -> Void)? = nil) { CATransaction.begin() CATransaction.setCompletionBlock(completion) viewController.view.backgroundColor = .white pushViewController(viewController, animated: animated) CATransaction.commit() } }
Set
SideMenuManager.default.leftMenuNavigationController?.dismissOnPush = false
In SideMenuManager I made public
public var activeMenu: Menu?
In SideMenuSettings I made public from internal
public typealias Menu = SideMenuNavigationController
When push
self.navigationController?.pushViewController(vc, animated: true, completion: {
SideMenuManager.default.activeMenu?.dismiss(animated: false)
})
from sidemenu.
It works for me version 6.5.0 Add
extension UINavigationController { func pushViewController(_ viewController: UIViewController, animated: Bool = true, completion: (() -> Void)? = nil) { CATransaction.begin() CATransaction.setCompletionBlock(completion) viewController.view.backgroundColor = .white pushViewController(viewController, animated: animated) CATransaction.commit() } }
Set SideMenuManager.default.leftMenuNavigationController?.dismissOnPush = false
In SideMenuManager I made public public var activeMenu: Menu?
In SideMenuSettings I made public from internal public typealias Menu = SideMenuNavigationController
When push self.navigationController?.pushViewController(vc, animated: true, completion: { SideMenuManager.default.activeMenu?.dismiss(animated: false) })
There is no push comletion method
from sidemenu.
@Dreamer4ik I also have this problem and did use your solution. However you can simplify it like this:
navigationController?.pushViewController(vc, animated: true) { [weak self] in
self?.navigationController?.dismiss(animated: true)
}
No need to directly access activeMenu (everything it relies on is public anyway).
I see the flicker a lot less on the Simulator but I don't know what that means.
from sidemenu.
@Dreamer4ik I have another solution (or workaround).
private func show(_ vc: UIViewController) {
UIView.animate(withDuration: 0.35) {
self.navigationController?.pushViewController(vc, animated: true)
} completion: { finished in
self.navigationController?.dismiss(animated: true)
}
}
Just call show(vc)
and there's no flicker. This solution works the same as yours but doesn't require the extension on UINavigationController.
I think the Flicker is caused by two animations interfering with each other. These are most likely the animations produced by pushViewController() and dismiss(). These two workarounds of ours guarantee that the second animation doesn't start until the first one has completed.
There's one odd thing that I notice. Here's what I see:
I tap on the hamburger menu and the side menu opens
I can see my VC1 on the right and the sideMenuVC
I tap on one of the rows in the sideMenuVC
I see the new VC2 slide in from the right
As VC2 moves in from the right I can see the left edge of VC1 also sliding to the left behind VC2
After VC2 fills the screen is when I see the flicker
I really am expecting that VC1 fades away behind VC2 rather than slides to the left
I suspect that something about what VC1 is doing during this transition is what is causing the flicker
from sidemenu.
Related Issues (20)
- How to do get background view as blur while sidemenu is opened HOT 10
- Side Menu latest version issue
- Using 'class' keyword for protocol inheritance is deprecated; use 'AnyObject' instead. HOT 1
- SideMenuNavigationController Initializer
- overlay for mainviewcontroler HOT 2
- bugly Crash -[UIWindow windowScene]: unrecognized selector sent to instance 0x105649c90 HOT 2
- addScreenEdgePanGesturesToPresent Doesn't Seem To Work
- Autorotate for all but one VC? HOT 1
- Side menu got Transparent when i scorll out side with a button HOT 1
- UIKit is not available when building for macOS.
- It crashed in iOS 12.4 pod version 5.0.3 6.0.9 and latest version
- The side menu appears invisible on the iphone XR HOT 1
- Side menu tab bar overlaps with the presenting vc's tab bar during transitions. HOT 1
- Rotation issue
- On iPad, viewDidAppear and viewWillAppear are called when dismiss is called, but not on iPhone.
- Can i present the menu and from inside there i push view controllers into a navigation view ?
- my app in Xcode is showing error at the time of archiving that SideMenuView not in scope 5 times as I have used sidemenuview under homeview,kindly confirm if you could help resolve the same HOT 2
- Privacy Manifest HOT 1
- Orientation Change time View Not Update
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 sidemenu.