You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pushing UIViewController from SideMenu sometimes blinks/flashes This bugs has no fix at 6.5.0 #694
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
Activity
northcity commentedon Jul 7, 2022
navigationController?.dismiss(动画:false)
let starVc = TDViewController()
starVc.hidesBottomBarWhenPushed = true
navigationController?.pushViewController(starVc,动画:true)
这样写可以解决问题,但觉得不是很对。
viihua commentedon Dec 20, 2022
可以尝试下这样设置,然后在pushViewController后手动调用下dismiss
Kedar-27 commentedon Apr 17, 2023
+1
Dreamer4ik commentedon Apr 25, 2023
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)
})
kaaaaai commentedon Jul 27, 2023
There is no push comletion method
phoney commentedon Oct 4, 2023
@Dreamer4ik I also have this problem and did use your solution. However you can simplify it like this:
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.
phoney commentedon Oct 5, 2023
@Dreamer4ik I have another solution (or workaround).
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