Whenever you declare a protocol, you must also create a delegate for the same
id <AddContentViewControllerDelegate > delegateAddContent
and create its ans property synthesized in a .m file
@property (nonatomic) id delegateAddContent
in .m
@synthesize delegateAddContent
Now you will need to send data through the protocol method that you have already defined using your .m file methods.
[self delegateAddContent]AddContentViewControllerDidCancel:(AddContentViewController *)controller];
there may be some class where you want to send the data. This class should match your protocol e.g. β
@interface ClassName : SuperClass<AddContentViewControllerDelegate >
and then you have to implement protocol methods. / for example β -
(void)AddContentViewControllerDidCancel:(AddContentViewController *)controller {
Also, the class corresponding to the protocol must own the protocol
= yourclassconformingprotocol.delegateController yourself.
You can also define the necessary methods in the @required and optional by @optional protocol
See Apple Documentation Protocol
source share