Code Monkey home page Code Monkey logo

Comments (7)

northcity avatar northcity commented on June 6, 2024

navigationController?.dismiss(动画:false)
let starVc = TDViewController()
starVc.hidesBottomBarWhenPushed = true
navigationController?.pushViewController(starVc,动画:true)

这样写可以解决问题,但觉得不是很对。

from sidemenu.

viihua avatar viihua commented on June 6, 2024

image
可以尝试下这样设置,然后在pushViewController后手动调用下dismiss

from sidemenu.

Kedar-27 avatar Kedar-27 commented on June 6, 2024

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.

Dreamer4ik avatar Dreamer4ik commented on June 6, 2024

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.

kaaaaai avatar kaaaaai commented on June 6, 2024

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.

phoney avatar phoney commented on June 6, 2024

@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.

phoney avatar phoney commented on June 6, 2024

@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)

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.