node ninja
node ninja

Reputation: 32986

How to implement a custom protocol

In this part of my code I get a warning message saying it doesn't implement the custom protocol I made.

detailViewController.delegate = self;

How do I implement the protocol?

Then when I run the program it crashes saying

'-[DetailViewController setDelegate:]: unrecognized selector sent to instance 0x6a1c450'

Upvotes: 1

Views: 623

Answers (1)

James Huddleston
James Huddleston

Reputation: 8448

Declare your class like this:

@interface DetailViewController : UIViewController <MyProtocol> {
    // Class stuff
}

Upvotes: 1

Related Questions