I usually add the UINotification observer in the init method and I remove them in dealloc.
However if I have a chain of UIViewControllers pushed by a UINavigationController, they are not deallocated when the next UIViewController is pushed. Consequently they all observe for the notification, and this is not what I want.
How can I add and remove notification observers when a UIViewController is pushed/pulled by a navigation controller ?
In order to get notified, you can set the delegate of the UINavigationController. This is quite cumbersome though, since the navigation controller only has one delegate. So in this case, I would have used
viewDidAppear:animated,viewDidDisappear:animatedand so on. These methods will be called on your view controllers as the navigation controller hides and shows them, and will also be called if you present a modal view controller in which case you probably also want to unregister notifications.