November 2013
Beginner
325 pages
9h 47m
English
Imagine the user changes the time zone on a Mac. Many objects in your program might want to know that this event has happened. Each of them can register as an observer with the notification center. When the time zone is changed, the notification NSSystemTimeZoneDidChangeNotification will be posted to the center, and the center will forward it to all the relevant observers.
In main.m, register the instance of BNRLogger to receive a notification when the time zone changes:
#import <Foundation/Foundation.h>
#import "BNRLogger.h"
int main (int argc, const char * argv[])
{
@autoreleasepool {
BNRLogger *logger = [[BNRLogger alloc] init];
[[NSNotificationCenter defaultCenter] addObserver:logger selector:@selector(zoneChange:) ...Read now
Unlock full access