Here is my current setup:
- CalendarViewController
- reloadCalendar()
- SideMenuViewController
- SideMenuView
- toggleEventsBtn
- SideMenuView
Here is some of my code inside SideMenuView
:
toggleEventsBtn.addTarget(self, action: "toggleButton:", forControlEvents: .TouchUpInside)
func toggleButton(sender: MenuControlButton!) {
let shouldShowEvents = sender.shouldShowEvents
NSUserDefaults.standardUserDefaults().setBool(shouldShowEvents, forKey: "ShowEvents")
}
After this code runs, I need it to call the reloadCalendar
method on CalendarViewController
. What's the best way to accomplish something like this?
Also, is it bad practice that I'm updating NSUserDefaults
from within a UIView
?
All help is greatly appreciated :)