I'm having a menuViewController
and a ContentViewController
using https://github.com/romaonthego/RESideMenu. The MenuViewController contain a list of different leagues retrieved from local database. This contain a league object with following vars leagueId
and name
. When a league is selected it should send the data to the ContentViewController. However the problem is that the MenuViewController is not presenting the viewController it is just hiding the menuViwController
and therefore i can't pass data from menuViewController
to contentViewController
when a cell with a league is selected. i've therefore tried to save the leagueId to a NSUserDefault
key, however this creates a problem when the app is exited, since it wont reset the NSUserDefaults. What is the best approach for such issue? should i rethink it?
pressing cell in menuViewController
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
NSUserDefaults.standardUserDefaults().setInteger(menuArray![indexPath.row].id, forKey: "leagueId")
self.sideMenuViewController.hideMenuViewController()
}