MFSideMenu
MFSideMenu copied to clipboard
How to Reload Tableview in SideMenuViewController.
I want to Reload tableview in SideMenuViewController .I noticed that ,that tableview is reloaded at the very first time but nothing is called when we are siding on the main view.I want to update menu tableview with recent upadate at the middle of the app.How can i do ...Please help me?
@saibabu I think you could use code like this:
[[(UITableViewController *)self.menuContainerViewController.leftMenuViewController tableView] reloadData];
Or encapsulate reloadData method into method of your side menu controller class and invoke it.
oh, I had just fix it in https://github.com/tranhieutt/MFSideMenu/commit/0f2ac95bf4221094da7ca98f54c8ab5bf45a51c3 You can call [reloadData] method in [viewWillAppear] in your side menu controller
I having solved this by posting notification in your mainViewController class and adding observer in SideMenuViewController. _mainViewController_***
-
(void)setupMenuBarButtonItems { [[NSNotificationCenter defaultCenter]postNotificationName:@"reloadTV" object:nil]; if(self.menuContainerViewController.menuState == MFSideMenuStateClosed && ![[self.navigationController.viewControllers objectAtIndex:0] isEqual:self]) { self.navigationItem.leftBarButtonItem = [self leftMenuBarButtonItem]; } else
{ self.navigationItem.leftBarButtonItem = [self leftMenuBarButtonItem];
}
}
***_SideMenuViewController_ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(customMethod:) name:@"reloadTV" object:nil];
-(void)customMethod:(id)sender { [self.tableView reloadData]; }