In this book, you have seen that all the delegate methods of objects are defined in the same class as the object. For example, one common class that you have seen is the UIAlertView class. When you have more than one button displayed in a UIAlertView object, you need to implement the alertView:clickedButtonAtIndex: method to handle the clicking of the buttons. This method can be defined with the same class it is used in (for example, in a View Controller class), or it can be declared separately in another class. However, if the method is defined in another class, how would you notify the View Controller when a button is clicked? This is the challenge: How do different classes communicate with one another? The following Try It Out shows you one way to do this using the NSNotification class.
TRY IT OUT: Using Notifications
#import <Foundation/Foundation.h> @interface AlertViewDelegates : NSObject <UIAlertViewDelegate> @end