element119
element119

Reputation: 7625

Adding More Than 2 Delegates in iPhone App

This is a simple question that can be answered fast by someone who's more familiar with Objective-C than I am- how can one add more than 2 delegates to a Class?

To clarify, I'm used to putting delegates in classes like this:

@interface ViewController : UIViewController <UIWebViewDelegate> { ...

When I try to put two delegates:

@interface ViewController : UIViewController <UIWebViewDelegate> <UITextFieldDelegate> { ...

...the app gives many errors, none of which help with the situation.

Is there a separator that I need to put between the delegates, or is it possible at all to have more than two?

Thanks for any help in advance.

Upvotes: 2

Views: 3240

Answers (1)

falconcreek
falconcreek

Reputation: 4170

The correct declaration for a class that implements multiple protocols is a comma separated list

@interface ViewController : UIViewController <UIWebViewDelegate, UITextFieldDelegate>
{ ...

Upvotes: 18

Related Questions