SWRevealViewController
SWRevealViewController copied to clipboard
Update Menu item
Hi, sorry for bothering, but
is adding/deleting a menu item when I click on a button possible?
I'm trying to update menu item dynamically, but I haven't succeeded yet.
For testing purposes, I've added another button which opens menuVC (the menu on the right in first picture) when you click it, and it works fine when I click said button (meaning that the menuItemArray in menuVC has been updated after clicking the button).
But why doesn't the actual side menu get updated?
(left one is the actual menu, right one is use for testing if menuItemArray has changed)
(this is my code, Key: "hasChangedReward" will tell if it's needed to update menuItemArray)
viewDidLoad is only called once. You have to update your data source (your arrays) in viewWillAppear and reload the table view.
Thanks for answering! I've searched some information about reload table view in viewWillAppear override function, and I found that I can't call reload function in viewWillAppear, but I can call it at another tableview function, I'm wondering that what's the problem I'm having now. Thanks again.
Your controller is not a UITableViewController but a UIViewController, so you have to have an outlet for your table view connected with the storyboard. After that you will be able to use it anywhere in the code.
Thanks a lot, I've solved the problem by taking your advice:))
viewDidLoad is only called once. You have to update your data source (your arrays) in viewWillAppear and reload the table view.
Thanks Brother i've solved the same problem by implementing your upper advice. :-)