IOS Journey the Observer
Cory Rylan
- less than a minute
The NSNotification observer allows you to add a observer which watches for a certain event to trigger. This is useful if a view come into the display or the app is resumed from being suspended in the background. This example is setting an observer to the UIApplicationDidBecomeActiveNotification
. When this event occurs the selector of the method of your choosing will fire. This is useful if the app has been suspended and need to update its information via web service.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(someMethod:)
name:UIApplicationDidBecomeActiveNotification object:nil];