Andrew
Andrew

Reputation: 16051

Making a class a delegate of more than 1 thing?

I have 2 parts of my class that want it to be the delegate.

So I have:

@interface RewriteViewController : UIViewController <MPMediaPickerControllerDelegate>

And this causes an error with it saying it needs to be SKVocalizerDelegate.

And if i have:

@interface RewriteViewController : UIViewController <SKVocalizerDelegate>

It says the same about the MPMediaPickerControllerDelegate.

But putting:

@interface RewriteViewController : UIViewController <MPMediaPickerControllerDelegate> <SKVocalizerDelegate>

gives me a huge amount of errors. How can I make it the delegate for both?

Upvotes: 1

Views: 340

Answers (1)

lxt
lxt

Reputation: 31304

You were almost there! You use a comma to show your class supports multiple delegates, like so:

@interface RewriteViewController : UIViewController <MPMediaPickerControllerDelegate, SKVocalizerDelegate>

Upvotes: 8

Related Questions