SideMenu icon indicating copy to clipboard operation
SideMenu copied to clipboard

viewDidDisappear and viewDidAppear are both called when SideMenu is appeared in ViewController

Open yeram0510 opened this issue 9 years ago • 6 comments

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.
  • [ ] 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

When I present SideMenu in MainViewController, viewDidDisappear and viewDidAppear are both called. It doesn't happen in 3.0.x version.. bug

yeram0510 avatar Nov 29 '17 02:11 yeram0510

This isn't a bug; everything still works as expected. Additionally, a quick debug shows that there's nothing SideMenu is doing that changed this behavior -- it's how the transition APIs work, likely in iOS11 if this wasn't happening before as you say.

jonkykong avatar Nov 29 '17 03:11 jonkykong

Thanks for your response. But i'm still wondering. Why ViewDidAppear and ViewDidDisappear didn't called at presenting and dismissing menu in older version, and why these events are called in latest version? Can you give some hint?

yeram0510 avatar Dec 07 '17 09:12 yeram0510

@yeram0510 I honestly don't have the answer for you. If you put a breakpoint in and trace the call stack, SideMenu code isn't called.

jonkykong avatar Dec 07 '17 17:12 jonkykong

@jonkykong I think I found a solution. If I add modalPresentationStyle = .overFullScreen to awakeFromNib() in UISideMenuNavigationController like in SideMenu version 3.0.2, the ViewDidAppear and ViewDidDisappear will not be called in MainViewController. Is there a reason why you deleted modalPresentationStyle = .overFullScreen in latest version?

yeram0510 avatar Dec 08 '17 13:12 yeram0510

@yeram0510 it was redundant as I set the modalPresentationStyle in SideMenuManager instead.

It doesn't make sense that setting the transition style in awakeFromNib would cause any change in behavior in the appearance methods being called, since in either place it's set it occurs well before any of the appearance methods should be called.

jonkykong avatar Dec 08 '17 18:12 jonkykong

@yeram0510 please dismiss SideMenu before you push or present to a new viewcontroller 👍

dungkv-1044 avatar Sep 26 '18 10:09 dungkv-1044