I am putting a test app together to demonstrate how users can be notified when something happens in the app (using NSNotifications). The user should be notified by an unobtrusive banner at the top of the screen regardless of what view controller is displayed at the time. I have the code already to draw the banner, but i am having problems setting up the NSNotification observers.
I have a storyboard with two viewcontrollers. How do I reference their init methods so i can add observers in for the NSNotification posts?
View controllers in a storyboard will be init’ed using
initWithCoder:. You would usually have a separate set up method that is called from this, and frominitWithNibName:bundle:just to cover you for all use cases.Or, start observing in viewDidLoad and stop in viewDidUnload.