MFSideMenu icon indicating copy to clipboard operation
MFSideMenu copied to clipboard

How to Reload Tableview in SideMenuViewController.

Open Sajanrav01 opened this issue 11 years ago • 3 comments

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?

Sajanrav01 avatar Nov 13 '14 16:11 Sajanrav01

@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.

yatikh avatar Dec 19 '14 08:12 yatikh

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

tranhieutt avatar Jan 17 '15 15:01 tranhieutt

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]; }

anil443 avatar Feb 01 '15 15:02 anil443