Sidemenu: non-animated dismissal results in black-screen

Created on 6 Oct 2017  路  8Comments  路  Source: jonkykong/SideMenu

New Issue Checklist


I have read the guidelines for contributing and I understand:

  • [x] My issue is happening in the latest version of SideMenu.
  • [x] My issue was not solved in the README.
  • [x] My issue can not be answered on stackoverflow.com.
  • [x] My issue is not a request for new functionality that I am unwilling to build and contribute with a pull request.
  • [x] My issue is reproducible in the demo project.

Issue Description

If you want to dismiss the menu, without an animation (eg: viewControllerForPresentedMenu?.dismiss(animated: false, completion: nil)) the dismissal results in a blackscreen. Is this behavior an oversight, or simply not supported, or is this a bug?
It's easily reproducible with the demo-project if you change the dismissal in handleHideMenuTap to non-animated.

It's not crucial for our usecase, but it did cost me an hour of debugging, so I wanted to ask if this is intended and why it does happen.

btw: great project!

Bug - Help Wanted!

Most helpful comment

@jonkykong I was having a similar problem but figured out why. The reason your demo project works is because you've set the sideMenuDelegate and therefore your "Work-around" here does what you say it should.

For us however (and maybe others), we had no use for these delegate methods and therefore did not set the sideMenuDelegate. Although you say the implementation of the sideMenuDelegate is optional, your work around requires you to set it in order for the fix to do its job. This could be where others are getting tripped up too.

Might be worth adding a note to the README or call transition.hideMenuStart().hideMenuComplete() in a different spot?

All 8 comments

Fixed. 10197c53cfb29208b2e2c983bf193b954955849f

This problem still persists...I am getting a black screen when I do :
dismiss(animated : false)

@iamchingel I just verified this works as expected in the demo project.

I encountered same issue.

I avoided the issue. I set SideMenuManager.menuAnimationDismissDuration to 0.0, and dismiss(animated: true).

// add function to class that YourViewController has SideMenu.
// UIApplication.shared.keyWindow?.rootViewController class is better.

// function that sets menuAnimationDismissDuration from the outside.
func setMenuAnimationDismissDuration(_ duration: Double) {
    SideMenuManager.menuAnimationDismissDuration = duration
}

```swift
/// ViewController in SideMenu
DispatchQueue.main.async { [weak self] in
(UIApplication.shared.keyWindow?.rootViewController as? YourViewController)?.setMenuAnimationDismissDuration(0.0)
self?.dismiss(animated: true) {
(UIApplication.shared.keyWindow?.rootViewController as? YourViewController)?.setMenuAnimationDismissDuration(0.35) // 0.35 is default value
}
}

Have the same issue too.

transition.hideMenuStart().hideMenuComplete() not executing if I call dismiss(animated: false).
But if I will correct the source code for this to be called, I still see an artifact on the screen while dismissing without animation.

Can someone please provide a modified demo project that simply illustrates this issue?

@jonkykong I was having a similar problem but figured out why. The reason your demo project works is because you've set the sideMenuDelegate and therefore your "Work-around" here does what you say it should.

For us however (and maybe others), we had no use for these delegate methods and therefore did not set the sideMenuDelegate. Although you say the implementation of the sideMenuDelegate is optional, your work around requires you to set it in order for the fix to do its job. This could be where others are getting tripped up too.

Might be worth adding a note to the README or call transition.hideMenuStart().hideMenuComplete() in a different spot?

This issue should now be resolved in version 6.0.0+ of SideMenu. Please run pod update and reopen this issue if the problem persists.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

selaysoysal picture selaysoysal  路  7Comments

aco314 picture aco314  路  6Comments

harshvishu picture harshvishu  路  3Comments

vkolosovsky picture vkolosovsky  路  4Comments

joebenton picture joebenton  路  5Comments