ENSwiftSideMenu icon indicating copy to clipboard operation
ENSwiftSideMenu copied to clipboard

Changing selected index of the SideMenu after switching from one view to another

Open vimalsaifudin opened this issue 10 years ago • 2 comments

Hi, I'm using a button within a view to switch to another view. Both the views are inside the navigation view controller's stack. After switching to the second view I need to change the selected row in the SideMenu Rows from 'View 1' to 'View 2'. How to do that ?

I tried to call selectRowAtIndexPath method of 'MenuTableViewController' from my ViewController, but that doesn't work.

tableView.selectRowAtIndexPath(NSIndexPath(forRow: selectedMenuItem, inSection: 0), animated: false, scrollPosition: .Middle)

Regards, Vimal Saifudin

vimalsaifudin avatar Jul 07 '15 08:07 vimalsaifudin

Is there any way to change selected index of the sideMenu from a view controller ?

vimalsaifudin avatar Jul 28 '15 11:07 vimalsaifudin

You can use self.sideMenuController()?.sideMenu?.menuViewController to access the tableViewController and change the selectedItem, and call reloadData().

See this question: https://github.com/evnaz/ENSwiftSideMenu/issues/105

eanvith avatar Dec 13 '15 17:12 eanvith