Cory Rylan

My name is , Google Developer Expert, Speaker, Software Developer. Building Design Systems and Web Components.

Follow @coryrylan
Cory Rylan Blog

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];
Twitter Facebook LinkedIn Email
 

No spam. Short occasional updates on Web Development articles, videos, and new courses in your inbox.

Related Posts

Cory Rylan Blog

IOS Character Counter

A short code example of how to make a character counter for IOS in Objective C.

Read Article
Cory Rylan Blog

IOS Journey Load Multi-Threading

A short code example of how to use multi-threading for IOS in Objective C.

Read Article
Cory Rylan Blog

IOS Journey Load Animation

A short code example of how to create a load animation for IOS in Objective C.

Read Article