mutualmobile / MMDrawerController

A lightweight, easy to use, Side Drawer Navigation Controller
MIT License
6.76k stars 1.38k forks source link

How to change centerviewcontroller based on the selection of sidemenu option?. #498

Open BugFinder27 opened 7 years ago

paramadharmika commented 7 years ago

Hi there, maybe I can suggest you a way around to solve your needs.

  1. You can create a handler when clicking on the table view cell e.g:

    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let model = self.items[(indexPath as NSIndexPath).row] as! LBDMenuModel;
    
        if (model.Id == "-1") {
            dashboardService.showMaps();
        } else if (model.Id == "-2") {
            dashboardService.getFavorites();
        } else {
            if (model.Id != "") {
                dashboardService.getDashboardPlaces(Int(model.Id));
            }
        }
        closeDrawer();
    }
  2. Then by using implementing that handler on your center view controller, you can navigate to your desired view controller e.g
    
    class LBDDashboardViewController: UIViewController, ILBDDashboardView {
    ...

func showMaps() { performSegue(withIdentifier: "dashboard_map_sid", sender: self); } }


From my perspective this is not a bug. Give it a go and let me know further