evnaz / ENSwiftSideMenu

A simple side menu for iOS written in Swift.
MIT License
1.82k stars 282 forks source link

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

Open vimalsaifudin opened 9 years ago

vimalsaifudin commented 9 years ago

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 commented 9 years ago

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

eanvith commented 8 years ago

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