开发者

Objective-C double Delegate protocol

开发者 https://www.devze.com 2022-12-09 22:09 出处:网络
I get the following error when compiling my app. warning: class \'ConfigureViewController\' does not implement the \'MPMediaPickerControllerDelegate\' protocol

I get the following error when compiling my app.

warning: class 'ConfigureViewController' does not implement the 'MPMediaPickerControllerDelegate' protocol

I know that it means I have to implement the delegate in the Controller. i.e @interface ConfigureViewController : 开发者_如何学运维UIViewController <MPMediaPickerControllerDelegate>

However, my current controller already has a delegate implementation for <UITextFieldDelegate> i.e @interface ConfigureViewController : UIViewController <UITextFieldDelegate>

How do I go around this issue?

Thanks, Tee


Just separate them by a comma: <MPMediaPickerControllerDelegate, UITextFieldDelegate>


One can implement multiple protocols by specifying multiple protocols in the class declaration.

In this case, in order to implement both MPMediaPickerControllerDelegate and UITextFieldDelegate, the class declaration would be:

@interface ConfigureViewController : UIViewController < UITextFieldDelegate, MPMediaPickerControllerDelegate >
0

精彩评论

暂无评论...
验证码 换一张
取 消