For iOS, I was using UIViewController's viewWillAppear and viewWillDisappear to hook up and unhook listeners on the controller's model. This way the controller doesn't do any work if it's view is not being shown, and can make sure everything is synced up when the view is shown.
I'd like to do the same for Mac, but don't see any way that an NSViewController gets notified about its view being added or removed from the display. Should I just subclass NSViewController, add the notification methods, and have whoever adds/removes the views call those methods?
As of Yosemite, the answer is now "Yes."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With