Delegate : It is a power tool for any developer. Delegates is a simple pattern of connecting 2 different objects or we can say one object act on behalf of other object or communicate with each other. Delegate object keep a reference to other object. Delegate allows you to customise the behaviour of other several objects.
Simple example of delegates is AlertViewController in which when you click on “OK” or “Cancel” button we can handle that by using delegates.
Lets start Creating Custom Delegates in iOS Objective C :
1. Create new project, till now you all know how to create Projects and then name it and saving it on your Mac.
2. Create new file name it to CustomDelegate and make it subclass of NSObject, you can also create specific protocols of different classes like NSString, UIView etc.
3. Adding the Delegate Protocol Methods.
In CustomDelegate.h : Declare class. Then Define the protocol. Then define protocol functions.