MF菜单问题使用dynamic菜单数据

我有一个问题,因为我想在我的侧面菜单中使用[MFSideMenu]Xcode Version 8.2.1ios 10.2.1dynamic数据,我已经创build了一个SideMenuViewController : UITableViewController我devise和填充我的侧边菜单中的数据。

当我启动应用程序,它显示所有的数据正确。 login后需要更新侧面菜单数据。 我login后更新菜单数组,但表格视图显示前面的数据。

唯一让应用程序显示正确的数据的是,如果我重新启动应用程序。

所以我的问题是什么可能是错误的,是否有可能在侧面菜单中使用dynamic数据,如果是这样的话,最好的办法是什么?

您需要使用NSNotificationCenter来刷新数据。

  1. 添加SideMenuViewController的ViewDidLoad

      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveTestNotification:) name:@"refreshData" object:nil]; 

2。 在SideMenuViewController中添加select器方法

  - (void) receiveTestNotification:(NSNotification *) notification { [tableview reloadData]; } 

3。 现在login后发布通知

  [[NSNotificationCenter defaultCenter] postNotificationName:@"refreshData" object:self];