For iOS, I used the UIViewController viewWillAppear and viewWillDisappear to connect and detach listeners from the controller model. Thus, the controller does not take any action if it is not displayed, and can ensure that everything is synchronized when the view is displayed.
I would like to do the same for the Mac, but I don’t see how the NSViewController receives a notification that its view is being added or removed from the screen. Should I just subclass NSViewController, add notification methods, and is there anyone adding / removing views that calls these methods?
source
share