SideMenu: Regression in 2.3.3 viewWillAppear not called

New Issue Checklist

I have read the guidelines for contributing and I understand:

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

Issue Description

viewWillAppear on menu’s table view is called properly only on first appearance. After that, it is not called before menu appears but only after it disappears.

The Example project is based on storyboards, but this issue appears when I setup menu in code. Here is very basic project with menu setup code taken from README: https://github.com/paiv/sidemenuappear/blob/master/sidemenuappear/ViewController.swift

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

In UISideMenuNavigationController

// Hack: force selection to get cleared on UITableViewControllers when reappearing using custom transitions
visibleViewController?.viewWillAppear(false)

I suppose this could be replaced by directly removing selection from rows, like

    if let tableView = (visibleViewController as? UITableViewController)?.tableView {
        if let indexPath = tableView.indexPathForSelectedRow {
            tableView.deselectRow(at: indexPath, animated: false)
        }
    }

In my case just uncommenting the whole viewDidDisappear fixed my issue and I haven’t experienced side issues.

@a7ex yes, it should be safe. The only purpose of it is to deselect the rows of the table view the next time the menu is revealed since the method wasn’t getting called automatically by the custom transition APIs.

+1 have the same behaviour. viewWillAppear is called when the menu is dismissed…