November 2013
Beginner
325 pages
9h 47m
English
In Chapter 27, you learned about the callback mechanisms helper objects and notifications. Callbacks allow other objects to call methods in your object in response to events. While perfectly functional, these approaches break up your code. Pieces of your program that you would like to be close together for clarity’s sake usually are not.
The Callbacks program includes the following code that calls back to the zoneChange: method:
[[NSNotificationCenter defaultCenter]
addObserver:logger
selector:@selector(zoneChange:)
name:NSSystemTimeZoneDidChangeNotification
object:nil];
It is natural, then, for someone reading your code to wonder, “What does this zoneChange: method do?” To answer this question, the ...
Read now
Unlock full access