Graphics Programs Reference
In-Depth Information
tification that the object registered for is posted, the center will try to send the object a
message. Since that object no longer exists, your application will crash. Thus, if an object
registers with the notification center, that object must unregister in its dealloc method.
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
It's important to understand that NSNotification s and the NSNotifica-
tionCenter are not associated with visual “notifications,”, like push and local notifica-
tions that the user sees when an alarm goes off or a text message is received. NSNoti-
fication s and the NSNotificationCenter comprise a design pattern, like target-
action pairs or delegation.
Search WWH ::




Custom Search